Keeping cron jobs alive...?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Keeping cron jobs alive...?
# 1  
Old 01-11-2007
Question Keeping cron jobs alive...?

Hi,
I'm very new to Unix so please bear with me... Smilie

Here is my requirement:
I need to create a cron job to run two different scripts at 1 a.m. every day.

Here's what I did:
I used the "crontab -e" command and created a crontab file using the vi editor.
When I exit the editor using :wq, the file is created in the /var/spool/cron/crontabs directory under my username.
Typing the command "crontab -l" lists the cron jobs.

Here's my problem:
When I type exit and log off, the cron jobs are stopped and the crontab file with my username becomes empty!!! When I log back on and type "crontab -l", nothing is listed.


Here's my question:
How do I create a crontab such that the cron jobs specified remain alive even after I log off? Smilie

System is Solaris 9.

Thanks a lot for any advice given.

Last edited by yogiB; 01-11-2007 at 06:36 AM..
# 2  
Old 01-11-2007
MySQL Update!

Folks,

I added the user (me Smilie ) to the "sys" group in the file /etc/group. Doing so seems to solve the problem. Now the user can log off without stopping the cron jobs.

Tommy, if you are reading this, thanks for your offer to help. If you like, you could still ask the admin exactly what happened here and post his explanation for the benefit of other readers.
# 3  
Old 01-12-2007
I dont think this is the correct approach of doing it. I think there is another way of achieving your goal.

The 'nohup' (i.e No HangUP) command keeps a job running even after the user has logged off. So, whatever command u want to keep executing, just prefix the 'nohup' command before it and also, run this command in the background. For Example

nohup <Complete path of your program> &

Hope that helps
# 4  
Old 01-12-2007
Hi skybird666, yogiB's problem is not how to keep a program executed at the prompt running after logging off. The problem was with cron and I am stumped with the solution.
I haven't seen cron give problems like this. We have housekeeping jobs and such defined in cron for several users that aren't in the sys group and there is no such problem...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Keeping std & err outputs alive and feed one log file in a one-shot way

Bonjour, I have a large script with a lot of print statements and misc commands. Standard and error outputs are redirected like into the following code : #!/usr/bin/ksh LOG=/<some dir>/log > $LOG exec >>${LOG} 2>>${LOG} print aaaaa print bbbbb print ccccc ... some_cmd That way,... (5 Replies)
Discussion started by: Fundix
5 Replies

2. Red Hat

Cron jobs

I'm running cronjobs on a redhat 5.X. Cronjobs are getting failed frequently so how to find the root cause (2 Replies)
Discussion started by: karthik9358
2 Replies

3. Solaris

Cron jobs and at jobs

There are two jobs in Solaris , Cron and at jobs.. I know how to disable or enable cron jobs. How can I enable at jobs and disable it. Kindly help. Rj (2 Replies)
Discussion started by: jegaraman
2 Replies

4. Solaris

keeping a process alive ?

Hello guys, I have one script running that I need to keep it running 24x7 so I'd like to know how can I implement a sort of monitoring process I mean if for some reason this process dies somehow it gets automatically started again. Thanks. (8 Replies)
Discussion started by: cerioni
8 Replies

5. Shell Programming and Scripting

cron jobs

Hi, please help on this am trying to exec the below mentioned cron jobs but its getting failed fro the past two days ###but when am trying to execte the cron by the times 23,29 18 * * * /export/home/inrvgo/thelak/China.sh its getting exec properly please help on this #... (8 Replies)
Discussion started by: thelakbe
8 Replies

6. UNIX for Dummies Questions & Answers

Keep Server Alive with Cron Job

Despite my best efforts, my media streaming server still dies sometimes and I am in a random place trying to ssh into the server to restart it on my cell phone after customers start calling.... I tried using google to track down a script that would do the following Every 5 min execute: sudo... (1 Reply)
Discussion started by: ajhalls
1 Replies

7. UNIX for Dummies Questions & Answers

cron jobs

Hi, We have a group of hosts using which the cron jobs are submitted... Few days ago i had submitted a cron job in of these hosts, but unfortunately forgot the host name :( Can anyone please help me out in finding this host name from which the cron s submitting the job, i dont want the... (2 Replies)
Discussion started by: bhavanisree
2 Replies

8. Solaris

Cron Jobs

I'm trying to run cron jobs to start any inhibited processes after a system reboot. I can schedule th cron, but i'm confused as to how to incorporated the reboot, since reboot is scheduled at different times, once every month. How can I write this to start every 15 min after after a reboot ... (2 Replies)
Discussion started by: Remi
2 Replies

9. UNIX for Dummies Questions & Answers

CRON Jobs

Hi, I am a total newbie to all things Unix. I've worked out I need to set up something that will allow me to automatically backup a DB for me, the DB is for a foum system I run. Now, I've only found out I need to use telnet for this, and worked out hwo to log into telnet today. From here... (4 Replies)
Discussion started by: eludlow
4 Replies
Login or Register to Ask a Question