Sponsored Content
Full Discussion: crontab+mplayer alarm clock
Top Forums Shell Programming and Scripting crontab+mplayer alarm clock Post 302682229 by hbar on Sunday 5th of August 2012 10:32:21 PM
Old 08-05-2012
Quote:
Originally Posted by agama
The way you have your command written, I wouldn't expect the volume to increase. The mixer command is invoked once, and if successful (&&) mplayer is invoked to play the mp3 looping through it 5 times.

If you want to bump the volume with each cycle through the file I would write a small script (alarm.bash or somesuch) and invoke that from cron. The script would look something like this:

Code:
#!/usr/bin/env bash
PLAYER=/usr/bin/mplayer
SONG=/home/hbar/Music/song.mp3

/usr/bin/amixer sset Master 35% >/dev/null 2>&1  # start with a default volume maybe??

for (( i = 0; i < 5; i++ ))
do
   /usr/bin/amixer sset Master 10%+ >/dev/null 2>&1
   $PLAYER -really-quiet -vo null $SONG >/dev/null 2>&1
done

In addition to Carona's suggestion, I'd toss in -really-quiet to cut the overhead of updates directed to /dev/null.
Are you meaning to execute from /etc/crontab? Can't I do it by

crontab <filename>.bash

?
 

3 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

alarm

Hello I have a server HP ES40 with unix 5.1B, and if i open from Start-Programs-IN Tools-GUI/pfmalarm/Alarm-start monitoring , I receive this error message "IOR : STRING IS TOO LONG ! MAXIMUM SIZE = 1024" Anybody heard about this error? Thanks Alin (0 Replies)
Discussion started by: tomaalin
0 Replies

2. Shell Programming and Scripting

Scripting an alarm

Hi All, I am monitoring batch Processes running in UNIX environment. I use PuTTy to monitor the process running. I have to continuously monitor and look on the screen if some error has come or not. If an error comes FAILURE word is displayed instead of SUCCESS as shown below on the... (2 Replies)
Discussion started by: sampandey31
2 Replies

3. Shell Programming and Scripting

Alarm clock error while executing the script

I am executing perl script on Linux machine and the script is running for the last 5 hours and while running the script I had an error message in a single line Alarm Clock and the script got stopped. I havnt scheduled the script.I have executed the script manually. There is no syntax errors in... (1 Reply)
Discussion started by: scriptscript
1 Replies
ALARM(2)						     Linux Programmer's Manual							  ALARM(2)

NAME
alarm - set an alarm clock for delivery of a signal SYNOPSIS
#include <unistd.h> unsigned int alarm(unsigned int seconds); DESCRIPTION
alarm() arranges for a SIGALRM signal to be delivered to the calling process in seconds seconds. If seconds is zero, no new alarm() is scheduled. In any event any previously set alarm() is canceled. RETURN VALUE
alarm() returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no pre- viously scheduled alarm. CONFORMING TO
SVr4, POSIX.1-2001, 4.3BSD. NOTES
alarm() and setitimer(2) share the same timer; calls to one will interfere with use of the other. sleep(3) may be implemented using SIGALRM; mixing calls to alarm() and sleep(3) is a bad idea. Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time. SEE ALSO
gettimeofday(2), pause(2), select(2), setitimer(2), sigaction(2), signal(2), sleep(3), time(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-06-12 ALARM(2)
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy