The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cron job starts new cron proccess ron76 SUN Solaris 3 05-11-2008 10:07 PM
Cron and Pseudo-Cron dingusmcghee UNIX for Dummies Questions & Answers 1 01-31-2008 09:58 AM
CRON usage for CRON job skyineyes UNIX for Dummies Questions & Answers 1 01-17-2008 07:17 AM
AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log Keith Johnson AIX 0 01-09-2008 05:32 PM
Cron : you are not authorized to use cron. Sorry. tt155 UNIX for Advanced & Expert Users 1 07-06-2005 07:37 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-01-2007
Registered User
 

Join Date: Mar 2007
Location: Ireland
Posts: 14
Cron Job

Hi

I want to execute a script on the last day of every month.
I tried using the following line but it failed:

Code:
50 23 * * * [ `date -d tomorrow +%d` -eq '01' ] &&  cd live/cgi-bin/;perl org_stats_monthly_cron_job.cgi
log shows:

Code:
CMD: [ `date -d tomorrow +
>  root 25487 c Mon Apr 30 23:50:00 2007
Its a Solaris box.
Could someone please help me out?

Thanks in advance.
Reply With Quote
Forum Sponsor
  #2  
Old 05-01-2007
Registered User
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 232
write the command to a file with #!/usr/bin/ksh at the beginning
make sure the script is executable
Reply With Quote
  #3  
Old 05-02-2007
Registered User
 

Join Date: Mar 2007
Location: Ireland
Posts: 14
Thanks funksen.

So in a file write:

Code:
#!/usr/bin/ksh

[ `date -d tomorrow +%d` -eq '01' ] &&  cd live/cgi-bin/;perl org_stats_monthly_cron_job.cgi
and save it as myfile.sh?

then in the crontab list put:

Code:
50 23 * * * myfile.sh
Is that right?
Reply With Quote
  #4  
Old 05-02-2007
sysgate's Avatar
Unix based
 

Join Date: Nov 2006
Location: /root
Posts: 1,197
chmod +x myfile.sh && put in the cron "50 23 * * * /path/to/myfile.sh"
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0