BackupPC-users

[BackupPC-users] check if user is still logged on before shutting down client after dump

2011-08-29 05:54:59
Subject: [BackupPC-users] check if user is still logged on before shutting down client after dump
From: Kenneth <meel2mi AT hotmail DOT com>
To: backuppc-users AT lists.sourceforge DOT net
Date: Mon, 29 Aug 2011 11:53:01 +0200
Hello, I'd like to shutdown my linux workstation after a dump, but it 
shouldn't shutdown the workstation when a user is still logged in. 
However, my scripts do not seem to work when called from backuppc. 
However, it works when I call wrapper.sh from the shell by entering 
./wrapper.sh "HOSTNAME" as user backuppc.

Any ideas how to solve this?

Thanks, Ken


config exerpt:
$Conf{DumpPostUserCmd} = 'wrapper.sh $host';

wrapper.sh contains:
HOSTNAME=$1
ssh root@$HOSTNAME  'bash' < /etc/backuppc/shutdown.sh

shutdown.sh contains:
#!/bin/bash

# Read logged users
USERCOUNT=`who | wc -l`;
# No Shutdown if there are any users logged in
if (($USERCOUNT>0))
then exit
else shutdown -h now
fi
exit 0






------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>
  • [BackupPC-users] check if user is still logged on before shutting down client after dump, Kenneth <=