windows and linux boot from the startup settings


Windows

1. Start a shortcut to Start> Programs> Startup folder copied into the program shortcut method requires start-up of this method requires the user to log
2, registered as a service, set the startup mode is automatically
   a, sc command
           sc create ResharperServices binpath = D: \ ResharperServices \ JetBrainsLicenseServer \ Windows \ DVT-jb_licsrv.amd64.exe of the type = own = Auto Start the DisplayName = ResharperServices
           sc sc stop Start service name service name sc delete service name sc qr server name
   b, modify the registry HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \% s, program path (AppDirectory), service names (the application)

   C, C code implementation
         1) need to implement SERVICE_TABLE_ENTRY ServiceTable [], indicate the service name and entry method
                SERVICE_STATUS ServiceStatus (service state); and ServiceHandler service message processing method entry
                // start control machine thread dispatch services
                StartServiceCtrlDispatcher (ServiceTable);

        2) hServiceStatusHandle = RegisterServiceCtrlHandler (_T ( SERVICE_NAME), ServiceHandler);
               Analyzing hServiceStatusHandle value, after the success of the particular application to continue processing code. Own code generally open thread execution, with the main event through interactive services.


Linux
. 1, modified boot scripts
modified /etc/rc.local(/etc/rc.d/rc.local) script, into their code execution
, for example, su - asocusr -c '/ opt / app / t24asoc-oceangw- SWIFT / bin / start.sh '

2, registered as a service
related to the preparation of startup scripts in /etc/init.d/, export the appropriate environment variables within the script
execute the command:
 chmod + /etc/init.d/tomcat the X-
mount , Run:
  LN -s /etc/init.d/tomcat /etc/rc2.d/S16tomcat    
#S: boot from the start K: stop 100: boot sequence (before performing a small value, a large value after execution) system level 2 rc2.d
set boot from the start, run
 the chkconfig --add Tomcat
the chkconfig --level 2345 Tomcat ON (2. 4. 3. 5-speed automatic start)
At this point we use chkconfig --list | grep tomcat command can be found Tomcat joined the chkconfig, it can modify its operation to achieve the level of start-up or not. And Tomcat can use the service tomcat start / stop / restart command on / off / reboot.
Restart the computer, verify that the Tomcat power-on reset.
Script files in other programs may be some changes, for example, some programs are not self-closing script (such as Tomcat's shutdown.sh script), it is also possible to start the name of the script is not called start.sh, specific modifications in accordance with the specific conditions of service.


Note:
Linux server level
345 is the need to turn on (become the off on) the numbers without extra time -level parameters, default opening is 2 to 5,
0 to 6 corresponding to the operating level as follows:
the Linux operating system has seven levels (runlevel)
run level 0: system shutdown, the system can not be set by default to run level 0, or can not start properly
run level 1: single-user work status, root permission for system maintenance, prohibits remote login
run level 2: multi-user state (not NFS)
run level 3: full multi-user state (there are NFS), after landing into the console command line mode
to run level 4: the system is not used, retain the
run level 5: X11 console after you log in GUI mode graphics
run level 6: a normal system shutdown and restart, the default operating level can not be set to 6, or can not start properly

Guess you like

Origin www.cnblogs.com/widget90/p/11267981.html