![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Capturing and sending of vmstat output everyday | yuvanash | Shell Programming and Scripting | 1 | 02-25-2009 03:48 AM |
| Everyday appending info about all processes which are active.. | mavikartal | Shell Programming and Scripting | 1 | 12-25-2008 11:32 PM |
| Google For Everyday Life - Part 1 | iBot | Cartoons for Geeks | 0 | 08-13-2008 07:30 AM |
| Cronjob - Redirect mail output to file, LINES & COLUMNS | jharvey | Shell Programming and Scripting | 0 | 04-14-2008 04:19 PM |
| how to make a line BLINKING in output and also how to increase font size in output | mail2sant | Shell Programming and Scripting | 3 | 04-14-2008 08:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to make cronjob output to different files everyday
Hello,
I have a cronjob that i am currently running which is as follows: php /home/****/cronjob.php --debug 2>&1 >> /home/cronjoboutput.txt That, as you may know, logs the output to a file called cronjoboutput.txt in the home directory. I want that cronjob to output to a different file everyday so if today is the 25th (25-10-2009) then it will output to "/home/ilog/25-10-2009.log". And if the date changes to the 26th then it starts logging to "/home/ilog/26-10-2009.log". Can someone please write up a command that does this for me? Thanks! |
|
|||||
|
Hello!
Per forum rules, and the benefit of all users, please search the forums before posting a question. You can easily search the forums using our internal Google search engine or our advanced internal search engine. You can also search our huge UNIX and Linux database by user generated tags or search the database for unanswered questions and provide an answer. Thank you. The UNIX and Linux Forums ---------- Post updated at 22:38 ---------- Previous update was at 22:37 ---------- Searching for "date in filename" gives (at least) this, this, this, and that. |
|
||||
|
Hey im sorry but i did search but i didnt find anything that i thought would be helpful.. I am very new to this.
---------- Post updated at 06:40 PM ---------- Previous update was at 05:56 PM ---------- Hello. From the /var/log/cron i see that it says this now: Oct 25 23:35:01 server crond[13367]: (root) CMD (php /home/admin/clients.hostwoot.com/cron/cronjob.php --debug 2>&1 >> /ipanel_log/$(/bin/date +) It looks like the command i put there is not working because i dont see any files there... The cron: php /home/***/cronjob.php --debug 2>&1 >> /ipanel_log/$(/bin/date +%d-%m-%Y).log |
|
||||
|
You need to escape percentage signs \% in crontab lines because they have a meaning to cron (see the manual for your crontab).
Whether either of the suggested solutions will then work depends on what shell your operating system uses for cron jobs. In general it is better to write a controlling script containing a shebang and any local environment settings and then call that script from cron. Also, there are 6 parameters to a crontab line. Your example line does not look like a normal crontab line. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|