maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   N900: Can profile type be determined in a shell script? (https://talk.maemo.org/showthread.php?t=81701)

rotoflex 2012-01-19 05:18

N900: Can profile type be determined in a shell script?
 
Is there a command line entry that returns a value that can be used to determine if the N900 is in Silent or General profile?

I am using a timed shell script which calls play-sound to play clock chimes, the disadvantage of which is that play-sound will always play, even when the phone's profile is set to Silent.

I need something to exit or otherwise control the shell script, along the lines of
if {
IsProfileSilent() == true
} exit;

Zas 2012-01-19 05:29

Re: N900: Can profile type be determined in a shell script?
 
cat /home/user/.profiled/current

Returns "silent" or "general".

michaaa62 2012-01-19 07:47

Re: N900: Can profile type be determined in a shell script?
 
Did you try, if TimedSilencer can do 'something' for you?

vi_ 2012-01-19 08:27

Re: N900: Can profile type be determined in a shell script?
 
This is the Rosetta stone you seek.

rotoflex 2012-01-19 08:45

Re: N900: Can profile type be determined in a shell script?
 
Quote:

Originally Posted by Zas (Post 1152636)
Returns "silent" or "general".

Thank you!

How would I capture & compare that string returned within a shell script? I am not very familiar with shell scripting.

-----


Quote:

Originally Posted by michaaa62
Did you try, if TimedSilencer can do 'something' for you?

Thank you, but I am trying to localize this within an existing shell script.

vi_ : Thank you. I see that
Code:

dbus-send --type=method_call --print-reply --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.get_profile
also returns the profile, but in a more verbose statement.
I think in this case only the "silent" or "general" returned by
Code:

cat /home/user/.profiled/current
would be easier to work with.

kureyon 2012-01-19 15:48

Re: N900: Can profile type be determined in a shell script?
 
Something like:

Code:

if [ `cat /home/user/.profiled/current` == "Outdoors" ]; then echo "Not inside";fi
should work.

rotoflex 2012-01-19 21:39

Re: N900: Can profile type be determined in a shell script?
 
Thank you all; it seems to have worked with
Code:

if [ `cat /home/user/.profiled/current` == "silent" ]; then
exit 1
fi



All times are GMT. The time now is 16:36.

vBulletin® Version 3.8.8