cancel
Showing results for 
Search instead for 
Did you mean: 

Crontab editing error

SOLVED
Go to solution
jona_1
Frequent Advisor

Crontab editing error

I put this line in crontab
======================================
* * * * sleep 60;date>>/tmp/inetd.txt;ps -eaflx|grep -i inetd|grep -v grep >> /tmp/inetd.txt
=======================================
but showing some error

* * * * sleep 60;date>>/tmp/inetd.txt;ps -eaflx|grep -i inetd|grep -v grep >> /tmp/inetd.txt
crontab: error on previous line; unexpected character found in line.
You have mail in /var/mail/root
unixh168-root@ / >
================================
can you pls help me.
REgards,
4 REPLIES
g3jza
Esteemed Contributor

Re: Crontab editing error

Hi,
your statement for cron job is incomplete.The time, when the job should be executed, consists of at least 5 fields:

minute hour monthday month weekday

And after that should be your command.

So you should add another '*' before the command.

#man crontab
g3jza
Esteemed Contributor
Solution

Re: Crontab editing error

like this:

* * * * * sleep 60;date>>/tmp/inetd.txt;ps -eaflx|grep -i inetd|grep -v grep >> /tmp/inetd.txt

Anyway, I don't know, whether the 'sleep 60' is of any use, as this commmand will be run every minute anyway...
jona_1
Frequent Advisor

Re: Crontab editing error

tnx
Dennis Handly
Acclaimed Contributor

Re: Crontab editing error

If you have something complex like this, you may want to put it all in script. That way you can easily change it and test it outside of cron.