HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
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

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.