473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Crontab problem

Hi,

I have jar file which creates some files. This jar file is called/run by shell script. Manually, I run the shell script and jar file creates the files and files' contents successfully.

When I set the cronjob to run the file. It runs the shell script and creates the file but somehow file does not have any content.

Anyone has any idea, why I am missing the contents of the file
(When I run the shell script by cronjob)?
Sep 12 '08 #1
3 3019
numberwhun
3,509 Expert Mod 2GB
Make sure that the command that you have in cron, to run, is the exact same command you use on the command line (including any options).

Also, you have to remember that when crontab runs, its actually root that is executing it, not the user.

Can you also provide a little more information into what the script is doing and what you aren't seeing?

Thanks!

Regards,

Jeff
Sep 12 '08 #2
Thanks to reply,

Yes, I ran the cron as root.

1) My shell script is responsible to run a jar file.
2) This jar file is responsible to create a file and writes some data in the file.

When I manually run the shell script, it runs jar file and I get the file with some data. It is OK.

But when I set cron to run the shell script then jar creates the file only. I don't get any data in the file.
Sep 12 '08 #3
numberwhun
3,509 Expert Mod 2GB
Thanks to reply,

Yes, I ran the cron as root.

1) My shell script is responsible to run a jar file.
2) This jar file is responsible to create a file and writes some data in the file.

When I manually run the shell script, it runs jar file and I get the file with some data. It is OK.

But when I set cron to run the shell script then jar creates the file only. I don't get any data in the file.
I think what you need to do is redirect standard error to a log file. Add something like this to the end of the command in your crontab entry:

Expand|Select|Wrap|Line Numbers
  1. 2>error_log.txt
  2.  
Let it run again and check that and see if there are any errors reported. Something has to be causing the data to no get into the file. You need to just figure out what and why.

Regards,

Jeff
Sep 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Arkascha | last post by:
Maybe someone can give me a short help with this... I got a server application in a LAMP environment doing batch tasks. A cronjob serves as a regular trigger, a metronom. The trigged...
3
by: Frank R. Suchy | last post by:
Hi, I want a php-script to maintain (some of) "my" cron jobs. Therefore it has to modify some crontab.txt (no problem) and has to execute crontab. But since php runs as the apache-user it...
3
by: rbt | last post by:
How can I safely append a crontab entry to a crontab file progammatically with Python? I need to handle crontabs that currently have entries and crontabs that are empty. Also, I'd like this to...
2
by: David Garamond | last post by:
I was thinking on how one would design an optimal (performance-wise) database of large number of schedules with crontab-like semantic. There will potentially be hundreds of thousands or even...
3
by: Sandman | last post by:
I have a PHP cli script, that backups my databases, using mysqldump via system(). When logged in with SSH, and launching the script with "./backup.php", all works just as it should, but when I...
4
by: Chr1s | last post by:
How do I execute a crontab command using php (not CLI) as user Joe? I don't have any problem getting output from commands such as 'ls' using passthru and exec but I am stumped with crontab. ...
2
by: martijn | last post by:
H! I have made a program that is checking if a program is running or not. If the program is not running then it must start the program again. in the /etc/crontab: * * * * ...
3
by: noama | last post by:
Hi, I'm using a computer with a Linux CentOS Operating system, which uses python 2.3 and known to break if python is upgraded to 2.5. Since i need to run 2.5 scripts on that machine, some people in...
0
by: Martin Marcher | last post by:
Hello, is anyone aware of a crontab library. Possibly even more complete, something that will let me create/manipulate/delete crontab entries in a nice way and install the new crontab...
3
by: xtremebass | last post by:
Hi , I am want to run the shell script to run every 10 minutes of interval ,so that i have used crontab command for scheduling the shell script .. it cant works . i have checked wall command in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.