hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : SSH Cronjob
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

SSH Cronjob

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 02-28-2007, 08:29 AM
priceww priceww is offline
WHT Addict
 
Join Date: Oct 2005
Posts: 113

SSH Cronjob


I wanna run this command "./adfsas.sh" Every 4 Hours can someone tell me what command I can use via SSH to set this cronjob?

Reply With Quote


Sponsored Links
  #2  
Old 02-28-2007, 09:01 AM
david510 david510 is offline
Web Hosting Master
 
Join Date: Oct 2004
Location: Kerala, India
Posts: 4,617
You can either use
* */4 * * * full path to the adfsas.sh
OR

* 0,4,8,12,16,20 * * * path to script if you need them to run at a specific time.

__________________
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
iWebManager | Access WHM from iPhone and Android

Reply With Quote
  #3  
Old 02-28-2007, 02:44 PM
jonwatson jonwatson is offline
Web Hosting Master
 
Join Date: Jul 2006
Location: Nova Scotia Canada!
Posts: 783
Command via SSH? Do you mean what to type once your are SSH'd in to the box?

If so:

Code:
 crontab -e
Then type in what david510 stated.

__________________
jonwatson.ca

Reply With Quote
Sponsored Links
  #4  
Old 03-01-2007, 04:59 AM
cybersavvy cybersavvy is offline
Junior Guru Wannabe
 
Join Date: Dec 2006
Posts: 66
you can also edit /var/spool/cron/root to put cron entries

restart crond service /etc/init.d/crond restart (not needed)

__________________
Reverse engineering Rocks

Reply With Quote
  #5  
Old 03-01-2007, 08:59 AM
jonwatson jonwatson is offline
Web Hosting Master
 
Join Date: Jul 2006
Location: Nova Scotia Canada!
Posts: 783
True, but manually editing the file will not catch errors. Using crontab -e will audit the file before saving and indicate if there have been any errors.

Also, the /var/spool/cron/root file is the root user's cron jobs. The OP didn't indicate whether he had root access to the box or not. Using crontab -e will bring up the crontab for whichever user issues the command.

__________________
jonwatson.ca

Reply With Quote
  #6  
Old 03-01-2007, 09:51 AM
sigma sigma is offline
Community Guide
 
Join Date: Apr 2001
Location: Pittsburgh, PA
Posts: 1,303
Also, the "crontab -e" method will work on almost any flavor of Unix, while the crontabs live in various places on various flavors, and require different methods of tickling the cron daemon to notice changes.

Kevin

Reply With Quote
  #7  
Old 03-01-2007, 08:02 PM
priceww priceww is offline
WHT Addict
 
Join Date: Oct 2005
Posts: 113
I runned this command "crontab -e * */4 * * * ./adfsas.sh" and heres the error I got
Code:
crontab: invalid option -- d
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [-u user] [ -e | -l | -r ]
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

Reply With Quote
  #8  
Old 03-01-2007, 08:07 PM
Patrick Patrick is offline
Stairway To Hosting
 
Join Date: Mar 2003
Location: Canada
Posts: 7,959
Run the command separately:

crontab -e

then add:

* */4 * * * /full/path/to/shellscript.sh

__________________

SYN Hosting - Affordable, Reliable & Secure Web Hosting - Proudly In Business Since 2006!

Host Unlimited Websites -/- cPanel -/- Softaculous -/- CloudFlare -/- SSH Access -/- 24/7 Tech Support
http://www.synhosting.com - Need a Canadian budget managed dedicated server? Click here for details.

Reply With Quote
  #9  
Old 03-02-2007, 12:00 AM
sigma sigma is offline
Community Guide
 
Join Date: Apr 2001
Location: Pittsburgh, PA
Posts: 1,303
And "./adfsas.sh" is not a full path to anything. In fact, that's the one path that's guaranteed not to work. You need something that looks like '/home/myname/script.sh'.

Kevin

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?