LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 10-26-2009, 06:57 PM   #1
pbxuser911
LQ Newbie
 
Registered: Oct 2009
Location: USA
Posts: 9

Rep: Reputation: 0
add a job to cron.daily


I need help adding a /testscript.sh to the cron.daily
 
Old 10-26-2009, 07:20 PM   #2
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 609

Rep: Reputation: 218Reputation: 218Reputation: 218
This may be a stupid question . . .

What is the problem, exactly . . . where in the process do you encounter issues? I take it from the way you ask the question that you know that you need to invoke the script from cron.daily . . . the permissions on the script either need to be executable or you need to invoke it as an argument to an explicitly called shell.
 
Old 10-26-2009, 08:45 PM   #3
pbxuser911
LQ Newbie
 
Registered: Oct 2009
Location: USA
Posts: 9

Original Poster
Rep: Reputation: 0
there already is a scipt that runs daily
i just want to add one add'l script, but i dont know how to do so
 
Old 10-26-2009, 08:54 PM   #4
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 609

Rep: Reputation: 218Reputation: 218Reputation: 218
Just make sure the script is executable (mode 755, 750, 700, etc) and move it into the cron.daily folder.

(as root)
Code:
chown root.root testscript.sh
chmod 700 testscript.sh
mv testscript.sh /etc/cron.daily

Last edited by foodown; 10-26-2009 at 08:56 PM.
 
Old 10-26-2009, 10:10 PM   #5
pbxuser911
LQ Newbie
 
Registered: Oct 2009
Location: USA
Posts: 9

Original Poster
Rep: Reputation: 0
the shell script is this:
#!/bin/bash

date=`date "+%m%d%y_%H%M"`
filename=/usr/local/pbx/pbx_did.txt

/usr/local/pbx/show_did.sh > $filename

echo | mailx -s mail@myemail.com-- -r fromme@myemail.com< $filename




and when i put that into the cron.daily it doesnt seem to work correctly, maybe i need to change the path's?
 
Old 10-27-2009, 01:19 AM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
cron has a minimal env/PATH setup. Always use full absolute paths to all cmds & files.
Exceptions are cmds built-in to the shell.
 
Old 10-27-2009, 10:08 AM   #7
pbxuser911
LQ Newbie
 
Registered: Oct 2009
Location: USA
Posts: 9

Original Poster
Rep: Reputation: 0
do i start with cd /usr/local/pbx
or just /usr/local/pbx
or is it /root/local/pbx?
 
Old 10-27-2009, 01:04 PM   #8
Davvvvid
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Rep: Reputation: 0
What I have used is:

/usr/local/pbx

That path works for my scripts
 
Old 10-28-2009, 08:50 PM   #9
pbxuser911
LQ Newbie
 
Registered: Oct 2009
Location: USA
Posts: 9

Original Poster
Rep: Reputation: 0
for some reason that doesnt work for me
 
Old 10-29-2009, 12:30 AM   #10
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Show your script and define 'doesn't work' in detail.
 
  


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
Daily cron job Talon21 Linux - General 3 03-05-2009 03:26 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Cron Job Daily petenyce Linux - Newbie 17 01-04-2006 11:13 AM
updatedb daily cron job TranceDude Linux - Software 12 08-25-2005 12:09 PM
Semi-Daily Cron Job Apollo77 Linux - General 8 01-13-2004 02:17 PM


All times are GMT -5. The time now is 09:10 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