On 1/31/2010 12:53 PM, Thomas Burgess wrote:
I am currious...is there a reason why pgrep wouldn't work as i'd expect on 
opensolars?

#!/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

Did you check if $USER is defined in cron?

As a test, create a cron job to print the environment to a file
"env > /tmp/testfile". I get:

HOME=/export/home/user
LOGNAME=user
PATH=/usr/bin:
PWD=/export/home/user
SHELL=/usr/bin/sh
SHLVL=1
TZ=Canada/Eastern

There's no $USER but there is $LOGNAME.
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to