Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-12-2013, 07:52 AM   #16
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286

Originally Posted by Wover View Post
Hurray! It works . In the last edits I left out username variable in the crontab lines. Thanks to all!
Following should have worked:
0 3 * * * "cd /var/scripts; ./ > /tmp/backup_logs"
0 3 * * * "/var/scripts/ > /tmp/backup_logs"
Did you try this? If not, what did you do?
Old 03-12-2013, 07:57 AM   #17
LQ Newbie
Registered: Mar 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled

1) Get the $PATH for the user you are running the script with and paste it under PATH in the crontab file
2) put /bin/sh in front of the command and don't forget the username either

Troubleshooting steps:

1) output some command to a file every minute, for example * * * * * root env > /tmp/env_output
2) If no output, check if crond is running
3) If output, try running the command manually from the shell and correct any errors that occur
Old 03-12-2013, 08:56 PM   #18
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,406

Rep: Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396
If the script has executable perms and has the first line '#!/bin/bash' (normal setup), then no need for eg /bin/sh in cron entry.
Speaking of which, if you use that approach, select the exact shell you want eg either sh or bash; they're not the same thing.
For portability I ALWAYS put the correct one in the first line of the script and use execute perms.
Also, I'd put the PATH inside the script for the same reason. It makes cron less cluttered and not all scripts need the same PATH.


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
[SOLVED] Automated dcraw and cjpeg script from crontab henkka Programming 3 01-05-2012 02:33 PM
automated backup GameSky Linux - Software 23 06-18-2007 01:57 AM
Automated HD backup General Linux - Hardware 3 05-11-2006 08:39 PM
Automated Backup via FTP KePSuX Linux - Newbie 3 02-11-2004 08:25 AM
automated FTP backup josephswagner Linux - Software 2 06-06-2003 04:42 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:54 PM.

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