We use Clients & Profits for client billing and it is unable to backup the database if any users have their client app running.  I was the bad guy last night that forgot to log out and decided that there has to be some easy way to kill an idle app.  I didn’t find any Mac apps that did exactly what I wanted, but I realized that between cron and applescript, I should be able to do what I wanted in a reasonably elegant way.

osascript lets you send Applescript commands to apps from the command line.  A little experimentation shows that:

osascript -e ‘quit app “Clients & Profits X 10.2″‘

cleanly exits the app.  a quick crontab -e from the terminal allowed me to:

#min hour mday month wday command
30     23    *         *          *        osascript -e ‘quit app “Clients & Profits X 10.2″‘

So now at 11:30 pm nightly, if my machine is running, I’ll cleanly shut down C&P.

  • Chris Lawrence

    Good solution, though I’ll mention a couple others. First, C&P has an automatic shutdown function for this very reason. Second, if you switch to a MySQL database, then backups can be taken with users still in. Many shops do this and take multiple backups during the workday. There’s no additional cost for either of these.

  • Chris Lawrence

    Good solution, though I’ll mention a couple others. First, C&P has an automatic shutdown function for this very reason. Second, if you switch to a MySQL database, then backups can be taken with users still in. Many shops do this and take multiple backups during the workday. There’s no additional cost for either of these.

  • http://jonathan-peterson.com/ Jonathan Peterson

    I didn’t realize that C&P had the auto shutdown function when I did the crontab solution.   The MySQL may be a good idea as we’re doing some other infrastructure changes to linux in the near future – thanks for the tip.

  • Chris Lawrence

    My pleasure. Feel free to give us a call and we can give you more information on the migration. Most everyone who has switched loves the increased speed and functionality of MySQL.

 
© 2012 My blog Suffusion theme by Sayontan Sinha