LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-17-2009, 11:23 PM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,462
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-17-2009, 11:27 PM   #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-17-2009, 11:39 PM   #3
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,462
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-17-2009, 11:44 PM   #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 12:03 AM. Reason: typo
 
Old 06-17-2009, 11:55 PM   #5
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,462
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-17-2009 at 11:56 PM.
 
Old 06-17-2009, 11:55 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
Actually

#!/bin/bash
 
Old 06-17-2009, 11:57 PM   #7
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,462
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 06:33 PM
trying to fix xwindows or just run command line... changing run levels dave247 Debian 2 11-18-2008 06:11 PM
Shell: command not found / Runs fine with "Run command" badbunny Linux - Newbie 1 01-22-2007 01:21 AM
Command to run another command against a list of files psweetma Linux - General 3 11-09-2005 05:29 PM
Morning all! Lordandmaker LinuxQuestions.org Member Intro 2 09-28-2005 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:00 AM.

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