![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| running script in cron - with ssh commands - not working | frustrated1 | Shell Programming and Scripting | 31 | 09-16-2008 10:14 AM |
| Running a script with cron | altamaha | Shell Programming and Scripting | 3 | 06-05-2008 08:46 AM |
| error in running shell script in cron | sari | Shell Programming and Scripting | 3 | 04-16-2008 04:09 AM |
| Running a script in cron question | NycUnxer | UNIX for Dummies Questions & Answers | 3 | 01-02-2008 01:22 PM |
| Running script using cron | ankurgupta | Shell Programming and Scripting | 4 | 12-12-2002 10:41 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Running a Cron Script only @ Startup Pls Help!!
Hi friends i have a script "backup.sh" which is stored in "/var/lib/pgsql" directory.
I want it to run as a cron so that it executes every time the system starts. I tried the follwing method I logged in as the root user and typed "crontab -e" The file was completly blank so i put the following line @ the beggining of the file "@reboot /var/lib/pgsql/backup.sh" It said "crontab: installing new crontab" But the cron did not run when i restarted the system(the script "backup.sh" mails after the task is comleted to an email address) So i typed "vi crontab" which resides in the "etc"directory the file was something like this: ------------------------------------------------------------------------------------------------------------ SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly ------------------------------------------------------------------------------------------------------------ I added the follwing line @ the end of the file "@reboot /var/lib/pgsql/backup.sh" So it looked like this ------------------------------------------------------------------------------------------------------------ SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly @reboot /var/lib/pgsql/backup.sh ------------------------------------------------------------------------------------------------------------ Even this method failed. Do i have to change the it to "@reboot bash /var/lib/pgsql/backup.sh" where u have to specify the command to enter "bash" in this case or enter "root" before the script path Can anybody pls help me in achieving the follwing task I would be very greatful. Last edited by perk_bud; 07-17-2007 at 05:28 AM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|