![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to start/stop cron jobs on live server | varaprasadu | SUN Solaris | 2 | 03-12-2008 10:09 PM |
| system won't start to GUI it stuck | eykyn17 | SUN Solaris | 7 | 11-14-2007 01:19 PM |
| cron does not start the need job | Anta | UNIX for Advanced & Expert Users | 5 | 07-10-2006 06:50 AM |
| System will not start | karlb1 | SCO | 1 | 11-04-2004 07:48 AM |
| how to start the x window system | nobody | HP-UX | 7 | 04-09-2004 04:55 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Cron job at system start up
I want to know if there is a way to make a certain set of programs start in order at system startup with cron or something else i dont know about.
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
The system startup files are located in /etc/rc2.d. You can add a file to this directory with the commands you want to run at system startup. Suppose you want to delete some temp files at system startup, you could put a file named TempFileDel in your /etc/rc2.d with the commands to delete your temporary files, so it'll run every time system reboots.
Regards, Tayyab |
|
#3
|
||||
|
||||
|
Helo.
As shereenmotor says, usually, startup scripts are located in /etc/rc2.d, but this depends on the UNIX/Linux you run and your system's default run level. But I'm afraid it's not that easy. The script name must follow some rules: - There are two kind of scripts, let's say: kill scripts and start scripts. Both stored in /etc/rcX.d. - kill scripts are executed first, after that start scripts. - kill scripts name must start with a "K". - start sctipts name must start with a "S". - Following the first letter, there must be a two digit number. This lets "rc" know the order for the execution of the sctrips. rc is the "master" script which calls the others. Have a look at your /etc/inittab. - Finally, a name of your choice. when "rc" calls this scripts it adds a parameter: start for "S" scripts and stop for "K" scripts. This allows you to use the same script for both operations, just using links. Well, the UNIX boot process is a little bit more complicated, but for now that's enough. In your case, you could create a scritp called TempFileDel (contuinuing with shreenmotor's example) which supports "start" and "stop" operations/parameters. For instance: Code:
#!/bin/ksh case $1 in start) echo Removing file... rm /tmp/somefile;; stop) echo bye!;; esac Code:
ln -s /path/to/TempFileDel /etc/rc2.d/S10TempFileDel ln -s /path/to/TempFileDel /etc/rc2.d/K10TempFileDel Regards. |
|
#4
|
||||
|
||||
|
Thanks grial, for refining my concepts about UNIX boot process. rgrds, Tayyab
|
||||
| Google The UNIX and Linux Forums |