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(3)						   BSD Library Functions Manual 						  ALARM(3)

NAME
alarm -- set signal timer alarm LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> unsigned alarm(unsigned seconds); DESCRIPTION
This interface is made obsolete by setitimer(2). The alarm() function sets a timer to deliver the signal SIGALRM to the calling process after the specified number of seconds. If an alarm has already been set with alarm() but has not been delivered, another call to alarm() will supersede the prior call. The request alarm(0) voids the current alarm and the signal SIGALRM will not be delivered. Due to setitimer(2) restriction the maximum number of seconds allowed is 100000000. RETURN VALUES
The return value of alarm() is the amount of time left on the timer from a previous call to alarm(). If no alarm is currently set, the return value is 0. SEE ALSO
setitimer(2), sigaction(2), sigpause(2), sigvec(2), signal(3), sleep(3), ualarm(3), usleep(3) HISTORY
An alarm() function appeared in Version 7 AT&T UNIX. BSD
April 19, 1994 BSD
All times are GMT -4. The time now is 02:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy