maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2008 / Maemo 4 / Chinook - Diablo (https://talk.maemo.org/forumdisplay.php?f=29)
-   -   Automatic Muting via cron (https://talk.maemo.org/showthread.php?t=20966)

cybergypsy 2008-06-13 20:31

Automatic Muting via cron
 
I'd like to use cron to automatically mute the volume of my OS2008 N800 every night and unmute it again in the morning , is this possible ?

thanks

maillaxa 2008-06-13 21:22

Re: Automatic Muting via cron
 
In short: yes :)

cybergypsy 2008-06-14 08:12

Re: Automatic Muting via cron
 
Thanks maillaxa, thats great!

For anyone else who would like to get this working , here is what I have done.
I set all this up via SSH on my desktop rather than the built-in terminal, this allows easy copy & paste as well as file transfers via secure copy (scp)
  1. Installed the aumix-gtk applcation from the repositories.
  2. Installed the cron package from this thread.
  3. As root created a crontab containing :-
    Code:

    30 23 * * * aumix -w 0
    00 7 * * * aumix -w 90

    This mutes the tablet at 11:30pm and un-mutes it at 07:00am
  4. Either reboot or run cron from the command line.

Good Luck
cybergypsy

maillaxa 2008-06-14 15:31

Re: Automatic Muting via cron
 
You should put this onto the wiki, I guess.

Bravo !

alephito 2008-06-20 12:23

Re: Automatic Muting via cron
 
Thanks, Cybergypsy.

My first contact with Linux was with my N810 and managing to set a crontab to mute and un-mute the device was really entertaining.

What other uses you have for cron?

aNoble 2008-06-20 12:50

Re: Automatic Muting via cron
 
I wonder if it would be possible to do something similar to this for the indicator light. I sometimes wake up to an annoying flashing blue light in the middle of the night when I receive an email.

cybergypsy 2008-06-20 12:53

Re: Automatic Muting via cron
 
I have turned off the LED notifications :-

Settings > Control Panel > Display > LEDs

....and sleep easy.

alephito 2008-06-20 13:22

Re: Automatic Muting via cron
 
Quote:

Originally Posted by aNoble (Post 193788)
I wonder if it would be possible to do something similar to this for the indicator light. I sometimes wake up to an annoying flashing blue light in the middle of the night when I receive an email.

Yes! That would be great.

BoxOfSnoo 2008-06-20 14:38

Re: Automatic Muting via cron
 
I already clicked it, but THANK YOU! (the automated ones are a little cheap)

I was envisioning that this would be an ideal task for a linux handheld, just never got to test it and list it out so directly.

I have also set it to mute for regularly scheduled meetings I have.

qwerty12 2008-06-20 15:06

Re: Automatic Muting via cron
 
Quote:

Originally Posted by aNoble (Post 193788)
I wonder if it would be possible to do something similar to this for the indicator light. I sometimes wake up to an annoying flashing blue light in the middle of the night when I receive an email.

Well, yes it can be done.

Make cron run gconftool which turns off the LED value (not sure on specifics but I know for SURE that the LED's are controlled via gconf)

aNoble 2008-06-20 15:06

Re: Automatic Muting via cron
 
Quote:

Originally Posted by cybergypsy (Post 193789)
I have turned off the LED notifications :-

Settings > Control Panel > Display > LEDs

....and sleep easy.

Yea, but I really like having the LED notifications during the day. And I'd rather not have to turn them on and off every night/morning.

alephito 2008-06-20 15:58

Re: Automatic Muting via cron
 
Maybe this thread can be of help.

qwerty12 2008-06-20 16:56

Re: Automatic Muting via cron
 
Here is a rip of cybergypsy's brilliant instructions but to do something else.

Putting the following into crontab should in theory put the tablet into offline mode at 11:30 PM and take it out at 7:00 AM.

Well, the dbus commands work as I spent 30 mins figuring them out but I don't know if cron will use them :p (you also may need to do dbus-uuidgen --ensure=/var/lib/dbus/machine-id as root)


30 23 * * * /usr/bin/dbus-send --system --type=signal /com/nokia/mce/signal com.nokia.mce.signal.sig_device_mode_ind string:"flight"
00 7 * * * /usr/bin/dbus-send --system --type=signal /com/nokia/mce/signal com.nokia.mce.signal.sig_device_mode_ind string:"normal"

aNoble 2008-06-20 18:07

Re: Automatic Muting via cron
 
Thanks for all of the great advice and I'm definitely going to see if I can the LED situation improved through cron.

But I was thinking what might possibly be an even better solution would be turn dim the LED based on the light sensor. So the darker it is the dimmer the LED gets. Because the LED tends to fade in and out at times I assume that it's able to be dimmed.

I'm a web developer so I don't have a lot of experience in programming at this level or in most of the languages typically used in Maemo. But if somebody can point me in the right direction I'd be happy to attempt to write something to do this sort of thing. Right now it's looking like I'll have to do my homework on DBUS and maybe Python. I'm comfortable with C# so maybe Vala would be better for me than Python?

Benson 2008-06-20 18:32

Re: Automatic Muting via cron
 
That's quite interesting; it's a good idea, and possible from a hardware perspective, but I doubt it's readily doable right now. Support should exist for an overall brightness control in mce, and I'm pretty sure it doesn't exist now. Alternatively, all LED patterns could be scaled and resubmitted, but I'm not sure whether there's a clean way to apply such changes. That's an inferior solution, anyway; if filing feature requests, the former is what you really want.

alephito 2008-06-21 17:37

Re: Automatic Muting via cron
 
Is there any way to set special hours for weekends?

For instance:

00 7 * * 1,2,3,4,5 aumix -w 90
00 10 * * 0,6 aumix -w 90

Is this valid if I want to sleep longer on Saturdays and Sundays?

alephito 2008-06-22 00:01

Re: Automatic Muting via cron
 
Quote:

Originally Posted by aNoble (Post 193824)
Yea, but I really like having the LED notifications during the day. And I'd rather not have to turn them on and off every night/morning.

I turned the "Device on" option off and left all the other options on.

This has stopped the device flashing the blue LED to indicate that the device is switched on when the display is in power save mode.

Now, with cron muting and switching to offline mode, there is no possible sound and LED use by night. Great.

alephito 2008-06-24 15:35

Re: Automatic Muting via cron
 
After upgrading to Diablo I am trying to install cron again.

After running 'tar zxvvf cron.tar.gz', I execute './cron/INSTALL' (as root) but the output is '/bin/sh: ./cron/INSTALL: Permission denied'.

What am I doing wrong? I don't remember if I had this problem the first time.

qwerty12 2008-06-24 15:41

Re: Automatic Muting via cron
 
I think you need to make sure you are root and make sure that the INSTALL script is set as executable.

alephito 2008-06-24 16:39

Re: Automatic Muting via cron
 
I am sure I am root (I see the # in the command line) and I run tar with the 'zxvvf' parameters. How can I check if the script is set as executable?

t24 2008-06-24 19:48

Re: Automatic Muting via cron
 
Quote:

Originally Posted by cybergypsy (Post 191971)
Thanks maillaxa, thats great!

For anyone else who would like to get this working , here is what I have done.
I set all this up via SSH on my desktop rather than the built-in terminal, this allows easy copy & paste as well as file transfers via secure copy (scp)
  1. Installed the aumix-gtk applcation from the repositories.
  2. Installed the cron package from this thread.
  3. As root created a crontab containing :-
    Code:

    30 23 * * * aumix -w 0
    00 7 * * * aumix -w 90

    This mutes the tablet at 11:30pm and un-mutes it at 07:00am
  4. Either reboot or run cron from the command line.

Good Luck
cybergypsy

Can you tell a little more please?

As root, I installed cron, and run crontab -e .. I entered something similar, " 30 23 * * * mplayer file.mp3 " but nothing happens at 23:30... I tried to edit /etc/crontab.. nothing happened

thx

cybergypsy 2008-06-24 19:59

Re: Automatic Muting via cron
 
you might need to specify the path to the .mp3 file as the command will be running as root and not as user.

I don't think the crontab files are stored in /etc , I think they're in /var somewhere but I can't check at the moment as I don't have it all installed currently due to the diablo upgrade this afternoon.

alephito 2008-06-24 20:51

Re: Automatic Muting via cron
 
The crontab files are stored in /tmp.

alephito 2008-06-24 21:06

Re: Automatic Muting via cron
 
Quote:

Originally Posted by alephito (Post 195047)
I am sure I am root (I see the # in the command line) and I run tar with the 'zxvvf' parameters. How can I check if the script is set as executable?

EDIT: Where should I be positioned to untar the files? If I am in the root directory (/root) the permissions are well assigned (but ./cron/INSTALL fails for other reason). The problem happened standing in mmc1.

Now, I get this when I execute ./cron/INSTALL:

~# ./cron/INSTALL
./cron/INSTALL: line 3: ./UNINSTALL: not found
cp: omitting directory './cron'
cp: cannot stat './crontab': No such file or directory
chmod: /usr/bin/cron: No such file or directory
chmod: /usr/bin/crontab: No such file or directory
ln: /etc/rc2.d/S89cron: File exists

alephito 2008-06-24 22:52

Re: Automatic Muting via cron
 
I solved doing this:

cd /root/cron
./INSTALL

Why './cron/INSTALL' did not work to begin?

Benson 2008-06-25 02:57

Re: Automatic Muting via cron
 
Because it was looking for ./UNINSTALL, not ./cron/UNINSTALL, and so on.

t24 2008-06-25 04:35

Re: Automatic Muting via cron
 
Quote:

Originally Posted by alephito (Post 195217)
The crontab files are stored in /tmp.

actually it seems to be in /var (chinook)

Anyway.. doesn't work for me >o<

# more /var/cron/tabs/root gives me

===========
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.3312 installed on Wed Jun 25 13:33:30 2008)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
35 13 * * * /usr/sbin/reboot
===========

which i created with crontab, as root.

But no reboot at 13H35.. Is my command ok?

I think cron is running since it shows with ps -aux | grep cron

I'm puzzled

qwerty12 2008-06-25 05:47

Re: Automatic Muting via cron
 
Quote:

Originally Posted by t24 (Post 195174)
Can you tell a little more please?

As root, I installed cron, and run crontab -e .. I entered something similar, " 30 23 * * * mplayer file.mp3 " but nothing happens at 23:30... I tried to edit /etc/crontab.. nothing happened

thx

" 30 23 * * * run-standalone.sh mplayer file.mp3 "

Mplayer sends a dbus command along the line. cron runs as root. dbus and root don't go so well on tablets hence the run-standalone.sh.

t24 2008-06-25 06:42

Re: Automatic Muting via cron
 
Quote:

Originally Posted by qwerty12 (Post 195431)
" 30 23 * * * run-standalone.sh mplayer file.mp3 "

Mplayer sends a dbus command along the line. cron runs as root. dbus and root don't go so well on tablets hence the run-standalone.sh.

Nope, doesn't work for me... mplayer or anything else, run-standalone.sh or not... Nothing never happens :mad:

What am I doing wrong???

Recap :
1- on my n810, downloaded the package from the thread "cron has gone".. cron.tar.gz (.zip)

2- as root, used the INSTALL script

3 - rebooted, checked with ps -aux | grep cron... which gives me
1220 root 1548 SW /etc/rc2.d/S89cron start

4 - as root, crontab -e, added the line
30 23 * * * run-standalone.sh mplayer file.mp3

5 - checked it's in /var/cron/tabs/root

6 - wait

7 - weep

alephito 2008-06-25 11:19

Re: Automatic Muting via cron
 
Quote:

Originally Posted by Benson (Post 195376)
Because it was looking for ./UNINSTALL, not ./cron/UNINSTALL, and so on.

Does it mean there is an error in the INSTALL file?

alephito 2008-06-25 11:28

Re: Automatic Muting via cron
 
Quote:

Originally Posted by t24 (Post 195409)
actually it seems to be in /var (chinook)

And what do you have in /tmp/crontab.3312 ?

t24 2008-06-25 11:36

Re: Automatic Muting via cron
 
Quote:

Originally Posted by alephito (Post 195528)
And what do you have in /tmp/crontab.3312 ?

There's no cron related files in /tmp :confused:

alephito 2008-06-25 12:11

Re: Automatic Muting via cron
 
Quote:

Originally Posted by t24 (Post 195409)
===========
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.3312 installed on Wed Jun 25 13:33:30 2008)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
35 13 * * * /usr/sbin/reboot
===========

I think there is (I am a newbie to Linux, I might be wrong). And look at what I quote from your file.

t24 2008-06-25 14:33

Re: Automatic Muting via cron
 
Quote:

Originally Posted by alephito (Post 195548)
I think there is (I am a newbie to Linux, I might be wrong). And look at what I quote from your file.

# (/tmp/crontab.3312 installed on Wed Jun 25 13:33:30 2008)

wtf?

No crontab.3312 in /tmp.. though there is mention of it in /var/cron/tabs/root ...

A problem with my config?

cybergypsy 2008-06-26 08:00

Re: Automatic Muting via cron
 
DistantFire asked me :-

Quote:

Default Cron & Aumix
I've been following your thread on Aumix and cron with great interest. I'd love to set up some cronjobs on my IT like the muting and/or the LED disabling during night hours.
Problem: I'm not a Linux or even Unix guru. I've never set up a chron job, never installed except from deb files, never did anything with tar.
2nd Problem: I tried to install cron (tar method), and can't tell if I succeeded or not.
3rd Problem: I tried to install aumix and got an "incompatible application" error message.
Is there some other s/w I need to install first ... like GTK or something? (I don't know what GTK is.)
I don't want to trash the forum with my petty problems, so I thought I'd ask you...
thanks,
DF
__________________
IT: N800 / Chinook
PC: Windows XP
Cell: LG Fusic (Sprint)
MP3: Insignia NS-DV4G or IT/Canola

So I have created a wiki page on wiki.maemo.org detailing the whole procedure.

BoxOfSnoo 2008-06-26 14:45

Re: Automatic Muting via cron
 
A couple of modifications should be made to the detailed procedure...

if you copy to an external memory card, it's probably going to be FAT or FAT32. chmod probably won't do anything.

I suggest that a) it either be temporarily copied to root's home directory and done from there or b) explicitly passed to the interpreter (probably the best choice) as in:
# sh /media/mmc2/cron/INSTALL

Are there any other problems foreseen with that?

alephito 2008-06-26 15:00

Re: Automatic Muting via cron
 
Quote:

Originally Posted by BoxOfSnoo (Post 196153)
if you copy to an external memory card, it's probably going to be FAT or FAT32. chmod probably won't do anything.

Yeah, that is what was happening to me.

Another thing I do not think is OK is the recommendation to install all Gronmayer repositories. Why not just install the required ones?

cybergypsy 2008-06-26 15:24

Re: Automatic Muting via cron
 
Thanks guys , excellent points.

Feel free to edit the wiki page and make the corrections.

BoxOfSnoo 2008-06-26 15:35

Re: Automatic Muting via cron
 
I made the change to copy it to the root folder, it seemed like the lowest impact change to make. I also changed it so you unpack on the device instead.

If you disagree, or prefer running it off the card, or whatever, feel free to re-edit.

L0cutus 2008-06-27 05:38

Re: Automatic Muting via cron
 
i've made a tar.gz of dcron 3.2 that support also:

user crontab (not only root)
/etc/cron.daily
/etc/cron.hourly
/etc/cron.weekly
/etc/cron.montly

for more info and download see here

hope it helps


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

vBulletin® Version 3.8.8