Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been sent a simple monitoring script by the author of ASSP, but I am not sure how to fix the PROC= line that causes an error.

#!/bin/bash
# ASSP watchdog process.

#
# Start in the correct directory.
BASE=/usr/share/assp/
cd $BASE

# Check for a running ASSP process.
PROC=`ps -axvO ucomm | grep Schedule::Cron | grep perl | awk '{print $1}'`

FILES=`lsof -p "${PROC}" | grep /usr/share/assp | grep perl`

# If ASSP is not running, start it.
if [ "${FILES}" ]
then {
echo "ASSP is already running."
}
else {
echo "Restarting ASSP."
perl assp.pl
} fi

It gives the following error.

ERROR: Must set personality to get -x option.

I am not sure if this line is remotely close to working. I was thinking of a write script that simply checks if there is a perl assp.pl script active and if not, start it manually. This server runs Debian and has ASSP/Postfix installed.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Part of the issue with ps is that there are some dozen versions of it and Linux's ps tries to be compatible with all of them by figuring out what version's options you're trying to use. Options starting with - are BSD-style, but -v and -O are conflicting BSD options.

Try ps ax to get the command column of all of the processes currently running. Since you're using it in a pipe it should use the whole command name, but if for some reason it truncates the commandline, use axww for unlimited width.

share|improve this answer
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.