Active Topics

 


Reply
Thread Tools
Posts: 1,320 | Thanked: 915 times | Joined on Feb 2010
#1
Hi,

I suffer from alot of random Wazapp crashes due to either signal loss or just PSM interfering.

For the moment I came up with a solution to missing messages due to a crash.

I want to make a script and then have it run every 30 mins or so to check if Wazapp is running and if it isn't restart it.

Here is what I have so far but there are errors I can't seem to solve, hoping you guys can help correct this

EDIT: This is the latest version that works!

Code:
#!/bin/sh

#set -x

#
# Variables Section
#==============================================================
# list process to monitor in the variable below.
#{wazapp} /usr/bin/python /opt/waxmppplugin/bin/wazapp/

PROGRAM1="wazapp"


# varible checks to see if $PROGRAM1
# is running.

APPCHK=$(ps aux | grep -C $PROGRAM1)

#
#
#==================================================================

# The ‘if’ statement below checks to see if the process is running
# with the ‘ps’ command.  If the value is returned as a ’0' then
# an email will be sent and the process will be safely restarted.
#


if [ $APPCHK = '0' ];

then

/opt/waxmppplugin/bin/wazapp/wazapp

else

echo 'Wazapp is running'

fi

echo $APPCHK

exit
PS. This idea was taken from this guys idea of a script for a similar purpose.

http://www.savelono.com/linux/bash-a...s-running.html
__________________
Well Nokia do at least know how to build a decent phone, just apparently don't know how to support it..

N900 Died Replaced with N8, Requested E7, "Accidentally Broke E7", Now rolling with an N9 and im loving it!


My Contributions

N900 Conversations Wiki Page

Last edited by godofwar424; 2012-07-05 at 21:37.
 
Posts: 1,320 | Thanked: 915 times | Joined on Feb 2010
#2
Newer Version of the script

Code:
#!/bin/sh

#set -x

#
# Variables Section
#==============================================================
# list process to monitor in the variable below.
#{wazapp} /usr/bin/python /opt/waxmppplugin/bin/wazapp/

PROGRAM1="wazapp"

#lists pid of that process

PID1=$(pidof $PROGRAM1)

#
#
#==================================================================

# The ‘if’ statement below checks to see if the process is running
# with the ‘ps’ command.  If the value is returned as a ’0' then
# an email will be sent and the process will be safely restarted.
#


if [ $PID1 = '' ];

then

/opt/waxmppplugin/bin/wazapp/wazapp

else

echo 'Wazapp is running'

fi

exit
__________________
Well Nokia do at least know how to build a decent phone, just apparently don't know how to support it..

N900 Died Replaced with N8, Requested E7, "Accidentally Broke E7", Now rolling with an N9 and im loving it!


My Contributions

N900 Conversations Wiki Page
 
Posts: 1,320 | Thanked: 915 times | Joined on Feb 2010
#3
SOLVED!

Big Thanks to ZogG and Doc_Scrutinizer
__________________
Well Nokia do at least know how to build a decent phone, just apparently don't know how to support it..

N900 Died Replaced with N8, Requested E7, "Accidentally Broke E7", Now rolling with an N9 and im loving it!


My Contributions

N900 Conversations Wiki Page
 
Posts: 180 | Thanked: 79 times | Joined on Mar 2012
#4
Edit the title name to "[SOLVED][SCRIPT HELP] Process is running or not" or whatever.
 
Posts: 1,320 | Thanked: 915 times | Joined on Feb 2010
#5
End result script works great here are the two scripts created from this idea!

INSTRUCTIONS!

Connect your N9 to your computer via USB and copy the waxmppplugin.desktop and wazapp.sh file onto your Device.

Now unplug the USB and open the Terminal, and type in the following. If any commands give a permissions error, try again as root.

Code:
cp /home/user/MyDocs/wazapp.sh /home/user/
cp /home/user/MyDocs/waxmppplugin.desktop /usr/share/applications/
chmod 755 /home/user/wazapp.sh
chmod 644 /usr/share/applications/waxmppplugin.desktop
Custom Wazapp.desktop

Wazapp.sh

Original Wazapp.desktop


If script 2 is place in /home/user/ and saved as wazapp.sh then using this .desktop file to replace the default one for Wazapp, you can achieve a Wazapp that will restart itself if it errors for any reason

If you Quit the app yourself, it will not restart until you do it manually

Scipt 1 (ZogG)

Script 2 (Doc_Scrutinizer)
__________________
Well Nokia do at least know how to build a decent phone, just apparently don't know how to support it..

N900 Died Replaced with N8, Requested E7, "Accidentally Broke E7", Now rolling with an N9 and im loving it!


My Contributions

N900 Conversations Wiki Page

Last edited by godofwar424; 2012-07-06 at 10:59.
 
ZogG's Avatar
Posts: 1,389 | Thanked: 1,857 times | Joined on Feb 2010 @ Israel
#6
Originally Posted by godofwar424 View Post
End result script works great here are the two scripts created from this idea!

Scipt 1 (VogG)

Script 2 (Doc_Scrutinizer)

If script 2 is place in /home/user/ and saved as wazapp.sh then using this .desktop file to replace the default one for Wazapp, you can achieve a Wazapp that will restart itself if it errors for any reason

If you Quit the app yourself, it will not restart until you do it manually

Custom Wazapp.desktop
fix my nick name please =)
__________________
IRC nick on freenode — ZogG
imgrup
 

The Following 2 Users Say Thank You to ZogG For This Useful Post:
Posts: 98 | Thanked: 20 times | Joined on Jan 2012
#7
ok i used only script 2 and the new desktop file but wazapp wont load, any clue?
 
Posts: 1,320 | Thanked: 915 times | Joined on Feb 2010
#8
Originally Posted by eltoffer View Post
ok i used only script 2 and the new desktop file but wazapp wont load, any clue?
Did you put the script in /hom/user/ and name it wazapp.sh

and put the .desktop file in /usr/share/applications/
__________________
Well Nokia do at least know how to build a decent phone, just apparently don't know how to support it..

N900 Died Replaced with N8, Requested E7, "Accidentally Broke E7", Now rolling with an N9 and im loving it!


My Contributions

N900 Conversations Wiki Page
 
Posts: 1,320 | Thanked: 915 times | Joined on Feb 2010
#9
Originally Posted by ZogG View Post
fix my nick name please =)
Sorry mate

Fixed now
__________________
Well Nokia do at least know how to build a decent phone, just apparently don't know how to support it..

N900 Died Replaced with N8, Requested E7, "Accidentally Broke E7", Now rolling with an N9 and im loving it!


My Contributions

N900 Conversations Wiki Page
 
Posts: 98 | Thanked: 20 times | Joined on Jan 2012
#10
Originally Posted by godofwar424 View Post
Did you put the script in /hom/user/ and name it wazapp.sh

and put the .desktop file in /usr/share/applications/
yup yup but no load
 
Reply


 
Forum Jump


All times are GMT. The time now is 17:42.