LinuxQuestions.org
Review your favorite Linux distribution.
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 06-18-2009, 12:23 AM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Rep: Reputation: 51
Want to run a command every morning ?


I want a command every morning at 09:00 AM?
I know its done through cron?
What steps I need to follow?
 
Old 06-18-2009, 12:27 AM   #2
mbostwick
Member
 
Registered: Feb 2009
Location: Where ever life takes me
Distribution: gentoo,opensuse,ubuntu, arch
Posts: 110

Rep: Reputation: 18
Here is a tutorial to using crons: http://www.cyberciti.biz/faq/how-do-...-or-unix-oses/
 
Old 06-18-2009, 12:39 AM   #3
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
I have learnt I think:
Code:
#crontab -e

30 13 * * * /root/runchown.sh
Edited runchown.sh with VI:
Code:
chown -R apache:apache /opstra/repos
I just want to run a script runchown.sh which will provide ownership to repos file under opstra directory.
Is it correct?
 
Old 06-18-2009, 12:44 AM   #4
mbostwick
Member
 
Registered: Feb 2009
Location: Where ever life takes me
Distribution: gentoo,opensuse,ubuntu, arch
Posts: 110

Rep: Reputation: 18
That should work. You can always double check with crontab -l. Also might want to add to the top of the /root/runchown.sh #!/bin/bash if thats the shell you are using

Last edited by mbostwick; 06-18-2009 at 01:03 AM. Reason: typo
 
Old 06-18-2009, 12:55 AM   #5
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Is it like this:

#vi runchown.sh
Code:
#!/bin/bash
chown -R apache:apache <path to folder>
Code:
[root@In1 ~]# crontab -l
30 13 * * * /root/runchown.sh
[root@In1 ~]#

Last edited by your_shadow03; 06-18-2009 at 12:56 AM.
 
Old 06-18-2009, 12:55 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Actually

#!/bin/bash
 
Old 06-18-2009, 12:57 AM   #7
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Yeah !!! Thanks to All.
 
  


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
How to enter graphical mode (run level 5) command line (run lenel 3) edmondgyampoh Linux - Newbie 3 05-15-2009 07:33 PM
trying to fix xwindows or just run command line... changing run levels dave247 Debian 2 11-18-2008 07:11 PM
Shell: command not found / Runs fine with "Run command" badbunny Linux - Newbie 1 01-22-2007 02:21 AM
Command to run another command against a list of files psweetma Linux - General 3 11-09-2005 06:29 PM
Morning all! Lordandmaker LinuxQuestions.org Member Intro 2 09-28-2005 02:40 PM


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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration