LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-26-2008, 04:34 PM   #1
ceantuco
Member
 
Registered: Mar 2008
Location: New Jersey
Distribution: CentOS, Debian, Mint, Backtrack, OpenSuse
Posts: 560

Rep: Reputation: 36
Question how to run a shell script automatically?


Hi guys,

I'm planning on writing a shell script to copy some files. I would like to set that script to run at certain time (let's say 11:00pm every day).
how can I accomplish that? is there a OpenSuse app that would let me do it?
thanks for your help guys! and happy Thanksgiving!
 
Old 11-26-2008, 04:38 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
that'll be cron you will want to explore.
 
Old 11-26-2008, 06:01 PM   #3
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
As mentioned you will want to setup a cron job.
Code:
crontab -e
the format is as follows
minute, hour, day of month, month, day of week command
00 11 * * * myscript.sh // runs your script at 11:00 am every day
00 23 * * * myscript.sh // runs your script at 11:00 pm every night.

for more info man cron
 
Old 11-26-2008, 06:24 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
Note also that the default env in cron is minimal, so always use the full absolute path to any programs or files used by your script.
 
Old 12-16-2008, 10:16 AM   #5
ceantuco
Member
 
Registered: Mar 2008
Location: New Jersey
Distribution: CentOS, Debian, Mint, Backtrack, OpenSuse
Posts: 560

Original Poster
Rep: Reputation: 36
sorry guys I haven't given you an update yet! Con really worked for me! THANKS!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run shell script as root automatically elempoimen Linux - Software 8 06-20-2010 01:24 AM
Run shell script automatically after Login. hnshashi Linux - Newbie 14 09-26-2008 04:43 AM
How to run a shell script evey day automatically at a particular time krevathi1912 Programming 3 09-22-2007 01:15 PM
RH8 - how to automatically run a shell script at boot time nu-B Linux - Newbie 2 11-03-2003 02:47 PM


All times are GMT -5. The time now is 08:49 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration