UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 22nd, 2006, 07:04 AM
ignignokt ignignokt is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 35 ignignokt User rank is Lance Corporal (50 - 100 Reputation Level)ignignokt User rank is Lance Corporal (50 - 100 Reputation Level)ignignokt User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 18 h 36 m 59 sec
Reputation Power: 2
Auto Run Scripts

I have a script that will be running on Solaris 9 and I was wondering if it is at all possible to have this script run every couple of hours? Anyone know how to do this?

Reply With Quote
  #2  
Old September 22nd, 2006, 08:10 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Novice (500 - 999 posts) Click here for more information
 
Join Date: Mar 2006
Posts: 713 SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 2 Weeks 23 h 16 m 11 sec
Reputation Power: 315
Yes indeed!!! What you want to do is look at cron (man cron, man crontab). Major thing is to ensure the script is executable and that you are not making any assumptions about the PATH variable (jobs run by cron get a really basic set of environment variables).

crontab -e (to edit the cronfile for the current user)
insert a line like:
30 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/to/script
to have it run every two hours at 30 minutes past, every day of the year. Change the leading 30 to 00 to have it run on the hour, to 10 to have it run at 10 minutes past,etc.

Reply With Quote
  #3  
Old September 22nd, 2006, 09:14 AM
ignignokt ignignokt is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 35 ignignokt User rank is Lance Corporal (50 - 100 Reputation Level)ignignokt User rank is Lance Corporal (50 - 100 Reputation Level)ignignokt User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 18 h 36 m 59 sec
Reputation Power: 2
question

i tried to run "crontab -e" to edit the crontab file and im getting the following:

sh: emacs: not found
crontab: temporary file empty

It will run on a Solaris 8 install correct??

Reply With Quote
  #4  
Old September 22nd, 2006, 11:06 PM
vlsimpson vlsimpson is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2005
Location: The grassy knoll
Posts: 115 vlsimpson User rank is Sergeant Major (2000 - 5000 Reputation Level)vlsimpson User rank is Sergeant Major (2000 - 5000 Reputation Level)vlsimpson User rank is Sergeant Major (2000 - 5000 Reputation Level)vlsimpson User rank is Sergeant Major (2000 - 5000 Reputation Level)vlsimpson User rank is Sergeant Major (2000 - 5000 Reputation Level)vlsimpson User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 1 h 59 m 2 sec
Reputation Power: 41
Quote:
Originally Posted by ignignokt
i tried to run "crontab -e" to edit the crontab file and im getting the following:

sh: emacs: not found
crontab: temporary file empty

It will run on a Solaris 8 install correct??


crontab -e opens an editor so you can write the file. In this case it is looking for emacs which apparently isn't installed.

You almost certainly have vi so set a couple of environment variables and try it again.

Code:
export EDITOR=vi
export VISUAL=vi

Reply With Quote
  #5  
Old September 25th, 2006, 06:42 AM
ignignokt ignignokt is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 35 ignignokt User rank is Lance Corporal (50 - 100 Reputation Level)ignignokt User rank is Lance Corporal (50 - 100 Reputation Level)ignignokt User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 18 h 36 m 59 sec
Reputation Power: 2
Thanks

That did the trick, thanks for your help. One last question. I know the syntax for the crontab file but does the file have to reside in a particular directory ? or can it just be in the home directory of the user?

Reply With Quote
  #6  
Old September 25th, 2006, 07:38 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Novice (500 - 999 posts) Click here for more information
 
Join Date: Mar 2006
Posts: 713 SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 2 Weeks 23 h 16 m 11 sec
Reputation Power: 315
It can reside in any directory that can be accessed.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Auto Run Scripts


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway