Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script which need to be run as cron job.

In the staging environment i could run the script as a cronjob. but in the production environment it is not working,

so i checked whether cron daemon is running on the production

ps -ax|grep cron

but this command gives me following error message.

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
 4120 ?        Ss     0:06 crond
13640 pts/6    S+     0:00 grep cron

could anybody explain me what is wrong with this command

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

ps ax|grep cron The error you get is because of the - in the ps command is not needed

It depends a bit on which version of ps you are using, on RHEL man ps says:

   This version of ps accepts several kinds of options:
   1   UNIX options, which may be grouped and must be preceded by a dash.
   2   BSD options, which may be grouped and must not be used with a dash.
   3   GNU long options, which are preceded by two dashes.

...

EXAMPLES
   To see every process on the system using standard syntax:
      ps -e
      ps -ef
      ps -eF
      ps -ely

   To see every process on the system using BSD syntax:
      ps ax
      ps axu
share|improve this answer
    
This confusion arises because GNU/Linux combines two different Unix traditions for the ps command syntax - BSD and SVR. ps -ef also works fine under Linux. –  RedGrittyBrick May 16 '12 at 9:10
add comment

Try the command ps -ef | grep cron

share|improve this answer
    
Welcome to superuser. Please remember to use "comments" (not "Answers") to ask the question poster for more information. I edited out the superfluous parts of your answer but feel free to reinstate them (use "rollback") if you disagree. But remember your answer may get downvoted if it doesn't look like a useful answer. –  RedGrittyBrick May 16 '12 at 9:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.