Wednesday, April 27, 2016

pids and cronjobs and scripts stomping on each other

 i am backing up a whole lot of data via a cronjob.   
 sometimes it takes a really long time. like so long   
 to bleeds over to the next backup cycle. this will   
 help me not run stuff in parallel. yuck. processes   
 stomping all over themselves is no fun.  
   
 this script sets the PID (process id) in a standard place.  
 if the PID is present, the script halts.  
 if the PID is not there, the script creates the PID file.  
 and continues along working.  
 but, if it cannot create, the script dies.  
   
 if the PID isn't present, the script creates the PID file.  
 and continues along working.  
 but, if it cannot create, the script dies.  
   
   
   
    
 PIDFILE=/var/run/script_name.pid  
   
 if [ -f $PIDFILE ]  
 then  
  PID=$(cat $PIDFILE)  
  ps -p $PID > /dev/null 2>&1  
  if [ $? -eq 0 ]  
  then  
   echo "process already running"   
   echo "process already running" | mail -s me@here.org   
   exit 1  
  else  
   echo $$ > $PIDFILE  
   if [ $? -ne 0 ]  
   then  
    echo "could not create PID file"  
    exit 1  
   fi  
  fi  
 else  
  echo $$ > $PIDFILE  
  if [ $? -ne 0 ]  
  then  
   echo "could not create PID file"  
   exit 1  
  fi  
 fi  
   
 work work work  
   
 # remove PID file  
 rm -f $PIDFILE  
     
   

Monday, April 11, 2016

solaris 11 studio 12.3 is a pain to install on zones

 like for serious.  
   
 sol studio needs a cert. 30 days  
 pkg set-publisher -k /root/certs/pkg.oracle.com.key.pem -c /root/certs/pkg.oracle.com.certificate.pem -G "*" -g https://pkg.oracle.com/solarisstudio/release solarisstudio  
   
   
 well. sharing sunstudio12.3 between the host and paravirtualized system is a no go. awesome.  
   
 /etc/zones/zone1.xml has:  
 filesystem special="/opt/solarisstudio12.3" directory="/opt/solarisstudio12.3" type="lofs"/  
   
 let's get rid of it:  
 # zonecfg -z zone1 remove fs dir=/opt/solarisstudio12.3