WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Scripting Help: Shutdown tinycore after application exits  (Read 9758 times)

Offline bogz007

  • Newbie
  • *
  • Posts: 1
Scripting Help: Shutdown tinycore after application exits
« on: July 10, 2012, 10:45:36 PM »
I'm trying to restrict users to specific applications (in this case, remmina with plugins), but no matter where I place/start my script, even after the specific application exits, tinycore still does not shutdown.

The script is meant to be flexible, calling on APPLICATION to specify what application to check on.

#!/bin/sh
APPLICATION='remmina'

while true
do 
if ps ax | grep -v grep | grep $APPLICATION > /dev/null
then
    echo "$APPLICATION running, everything is fine"
else
   exitcheck.sh shutdown   
fi
done




Can someone help me build a script that can shutdown tinycore if an application exits? (either closed by user or programmatically by another script, or errors, hopefully it won't matter...)
« Last Edit: July 10, 2012, 10:53:34 PM by bogz007 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11695
Re: Scripting Help: Shutdown tinycore after application exits
« Reply #1 on: July 10, 2012, 11:01:01 PM »
Hi bogz007
For starters, remina is spelled with one m.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Scripting Help: Shutdown tinycore after application exits
« Reply #2 on: July 11, 2012, 01:15:31 AM »
... and IIRC, busybox ps wouldn't take "ax" options.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Scripting Help: Shutdown tinycore after application exits
« Reply #3 on: July 11, 2012, 02:09:53 AM »
 shutdown like this works for me, in a script or at the CLI

   sudo poweroff

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11695
Re: Scripting Help: Shutdown tinycore after application exits
« Reply #4 on: July 11, 2012, 02:19:18 AM »
Hi bogz007
Quote
shutdown like this works for me, in a script or at the CLI
   sudo poweroff
Don't do that if you want backup to run.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11695
Re: Scripting Help: Shutdown tinycore after application exits
« Reply #5 on: July 11, 2012, 03:14:58 AM »
Hi bogz007
Apparently remmina is spelled with two ems, my eyes just had trouble seeing it in AppBrowser due to a small font.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Scripting Help: Shutdown tinycore after application exits
« Reply #6 on: July 11, 2012, 04:39:19 AM »
Hi bogz007
Quote
shutdown like this works for me, in a script or at the CLI
   sudo poweroff
Don't do that if you want backup to run.

Thanks for the tip, I've been looking for a way to shutdown without running backup (easily)  yet still allow restore to function at start-up.  "norestore" boot option doesn't allow to prohibit backup whilst allow restore.  I make an extension for most settings, but some need to be loaded later (later than renaming tcz's would allow).   Am not hijacking ok :)

Thanks again

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Scripting Help: Shutdown tinycore after application exits
« Reply #7 on: July 11, 2012, 04:45:49 AM »
Just add the shutdown command to where-ever you start the one app, right after it.

remmina
sudo poweroff
The only barriers that can stop you are the ones you create yourself.