View Single Post
  #5  
Old 21st September 2010, 16:02
zabersoft zabersoft is offline
Member
 
Join Date: Aug 2010
Posts: 33
Thanks: 1
Thanked 2 Times in 1 Post
Default

I have now spent the day implementing Till's approach and it works like a beaut.

What I've done is create a cron job which runs a small PHP file which checks whether the bash script Till posted is running, and if not starts it. This is to ensure that it always is active (even after a reboot) - I guess you could add it to /etc/init.d but I didn't want to bother with that.

This is my PHP cron job:

PHP Code:
//Path to sitekick internal system files
$sitekick_sys "/var/www/xxxxx/sitekick/"

     
//Check if ISPConfig updater process is running - if not, start it
      
exec("ps aux | grep '/var/www/xxxxx/sitekick/[i]spconfig_updater.sh' | wc -l"$check);
      if(
intval($check[0]) > 0) { 
          echo(
'ISPConfig updater is already running');
      } else {
        echo(
'Updater not running - starting in background');
        
$command "nohup /var/www/xxxxx/sitekick/ispconfig_updater.sh > /dev/null &";
        
exec($command);
        echo 
$command;
      } 
As you can see I placed the bash script in another location than the one Till mentioned, as I want to keep our own stuff outside of ISPConfig dirs. Also, I had to change ownership of the script to root for everything to work properly.

I did not disable the "regular" server.sh cron job, as I saw no reason to. I still want things to work as usual in ISPConfig if we set up a client/vhost manually in the ISPConfig back-end.

All Till's bash script really does is just wait for .run to be touched/created and then do the update. I modded it slightly so that it only waits 5 seconds between each check. I can't see that this tweak should have any detrimental effect.

I still use my elevated rights executable as posted in the original post - but now its job has changed to:
1) touch .run (you need to be root to do this, so it's a problem from apache)
2) Run all my post ISPConfig update actions as root - I changed this to all be located in a custom PHP file which is run by my elevated rights executable - for easier maintenance

Anyway - Here's a happy man signing off as everything is working as it should
Reply With Quote