The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Keeping your SSH connections alive with autossh iBot UNIX and Linux RSS News 0 05-16-2008 12:20 PM
Cron jobs ajadaun HP-UX 5 10-15-2007 12:14 PM
cron jobs not run robertsnoog Linux 4 02-13-2007 12:24 PM
Cron Jobs Remi SUN Solaris 2 01-03-2007 07:12 PM
cron jobs dozy UNIX for Dummies Questions & Answers 3 10-27-2004 09:41 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-11-2007
yogiB yogiB is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 2
Question Keeping cron jobs alive...?

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

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?

System is Solaris 9.

Thanks a lot for any advice given.

Last edited by yogiB; 01-11-2007 at 06:36 AM..
  #2 (permalink)  
Old 01-11-2007
yogiB yogiB is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 2
Thumbs up Update!

Folks,

I added the user (me ) 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 (permalink)  
Old 01-12-2007
skybird666 skybird666 is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 2
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 (permalink)  
Old 01-12-2007
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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...
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:49 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0