I am currious...is there a reason why pgrep wouldn't work as i'd expect on 
opensolars?

I come from FreeBSD and i usually use pgrep to check if a process is running 
for a script.

For instance, i have a script which i use to check if rsync is running, if it 
isn't running, then it will rsync, if it is, then it should skip rsync.  I put 
this in crontab for every 15 minutes.

On FreeBSD this works fine, on OpenSolaris it doesn't seem to be working.

any idea why this should be?

When i try to run this script manually, and it is already running, it works 
exactly as expected.
anyways, this is the script (i've changed some stuff but you should be able to 
get the idea)



#!/bin/sh
PATH=/bin:/usr/bin:/usr/sbin
SERVICE='rsync'
REMOTE='wonsl...@xxx.xxxx.xxx:/home/xxxxxx/xxxxx/'
LOCAL='/tank/nas/dump/'
LOG='/export/home/wonslung/log/rsync.log'
if pgrep -u $USER $SERVICE
then
    echo "$SERVICE is running, skipping"
else
$SERVICE -ave ssh --delete $REMOTE $LOCAL >>$LOG
fi
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to