How do I do that?

Hello I need an automatic restart script, that restarts a service if the process is not there.

At the moment I start the process over [cmd=]screen -dmS "NAME" "DATA"[/cmd]

Please help me I'm a newbie in this section.


Sorry for Bad English
 
Does not sound a very complex task to do with a shell script, that can be scheduled itself.
Something like the following can do the trick, if the context is simple:

Code:
#!/bin/sh                                                                                  


PROC_NAME="myproc"

while :;
do

    pgrep $PROC_NAME > /dev/null

    if [ $? -ne 0 ]
    then
        echo "Restarting process $PROC_NAME"
    else
        echo "Process $PROC_NAME running!"
    fi

    sleep 5
done

But without information it is quite difficult to understand what is your aim.
 
Back
Top