![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to call a shellhaving sql script from cronjob | azum | Shell Programming and Scripting | 3 | 07-10-2008 06:22 AM |
| cronjob inside the script | namishtiwari | Shell Programming and Scripting | 3 | 02-04-2008 04:35 AM |
| How to run a script as different user inside cronjob in solaris. | csg_user | SUN Solaris | 11 | 12-15-2007 02:49 PM |
| help help cronjob problem with script | bucci | Shell Programming and Scripting | 4 | 02-10-2007 12:38 AM |
| Shell script not running thru Cronjob | gauravshrinivas | Shell Programming and Scripting | 8 | 11-03-2006 06:17 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi all
Recently i had finished a perl script. When i run manually, the script work fine. But when i wanted to put the script in cron, it didn't get the same output as it run manually. I felt that it only execute the script until certain line then it stop as i see most of the related files didn't update after the script run by cron. Below is the cron i put 0,30 * * * * perl /home01/user/cheah/trigger_resend/complete.pl >/dev/null 2>&1 Did anyone can help on this? Thanks very much........... |
| Forum Sponsor | ||
|
|
|
|||
|
i havent try the absolute path.
What do you mean by "Remember all your standard output/error you are redirecting to null" The output i meant is that i expected the script will generate 5 files after it being execute. But when using cron, it only generate one of the file, feel like the script processing half way |
|
||||
|
Did you find anything in cron log ?
I assume your script has executable permissions. I tried following simple code in my host, Code:
#!/bin/bash for i in 1 2 3 4 5 do touch file_$i echo "File generated : file_$i" done Quote:
- nilesh |
|
|||
|
When you execute from your account there is an ENVIRONMENT. When you execute from cron there is no built-in environment and if you need anything like paths, etc. you have to specify it in your script, e.g.
$ENV{PATH} = "/x/y/z"; or what ever... my $list_var; open(HNDL, ">/some/simple/file.txt"); foreach $list_var ( sort keys %ENV ) { print HNDL "$list_var -- $ENV{$list_var}\n"; } close HNDL; Try that from both your command line and from cron and see what the difference is in your environments. When you run from cron you might be missing something you will need to specify... |
|
|||
|
Hi Airwalker83,
If you haven't tried, you may put this as the first line of your perl script: #!/usr/bin/env perl and edit your crontab as: 0,30 * * * * /home01/user/cheah/trigger_resend/complete.pl >/dev/null 2>&1 assuming your script is executable. ---------------------- If this doesn't solve your problem, you may try to put the following line as the first line of your script : . /home/(username)/.bash_profile to set the necessary environment in the script because of the reasons "quine" mentioned and leaving the crontab as your original post. |
|||
| Google UNIX.COM |