You are here

A di ndonje nga ju funksionin e cronit se manxiu jeten

sokolnushaj's picture

Cuna a ka ndonje ketu qe te ndihmon me cron se ma nxiu jeten.
Une kam bere ket scriptin ketu:

#!/bin/bash

# a simple script to capture 2 hr of tar
mplayer -vc null -vo null -ao pcm:fast:waveheader:file=stream.wav "http://tar.serverroom.us:9078/" &
# the & sets the job running in the background

sleep 1m

kill $! # kill the most recently backgrounded job
------------------------------------------------------
#improve sound quality and volume using sox
sox stream.wav -n stat > stats 2>&1 || exit 1
VOL=$(grep 'Volume' stats | sed 's/^.*[ \t]//')
sox -v $VOL stream.wav aLive.wav || exit 1
rm stream.wav
------------------------------------------------------
#convert to mp3
for i in *.wav; do
if [ -e "$i" ]; then
aLive=`basename "$i" .wav`
lame -h -b 192 "$i" "$aLive.mp3"
fi
done
------------------------------------------------------
#need to clear up
rm *wav stats

#end

kjo eshte direktorija ku qendron skripti

sn0m@sn0m-laptop:~/bin$ ls -l
total 36
-rw-r--r-- 1 sn0m sn0m 483 2008-12-10 21:41 mpl_tar~
-rw-r--r-- 1 sn0m sn0m 501 2008-12-10 21:41 mpl_tir_liv~
-rwxr-xr-x 1 sn0m sn0m 501 2008-12-10 21:41 mpl_tir_live
-rwxr-xr-x 1 sn0m sn0m 797 2008-12-10 23:42 record_aLive
-rw-r--r-- 1 sn0m sn0m 797 2008-12-10 21:41 record_aLive~
-rwxr-xr-x 1 sn0m sn0m 827 2008-12-10 21:41 record_liv_from_tirana
-rw-r--r-- 1 sn0m sn0m 827 2008-12-10 21:41 record_liv_from_tirana~
-rwxr-xr-x 1 sn0m sn0m 806 2008-12-10 21:41 record_rikoshet
-rw-r--r-- 1 sn0m sn0m 806 2008-12-10 21:41 record_rikoshet~
sn0m@sn0m-laptop:~/bin$

tani une dua qe ta run nga croni. kjo eshte outputi i crontab:

sn0m@sn0m-laptop:~/bin$ sudo crontab -l
[sudo] password for sn0m:
# m h dom mon dow command
#script to record record_aLive $
* * * * * ~/bin/record_aLive
$
#

puna eshte qe mazalla se fillon arrrhhhhhh
ca po bej gabim ketu..
flmnderit ne advance
Koli

Desktop Environment: 
Programe: 
Seksioni Kernel: 
Udhëzues: 
Sisteme Operativë: 
laurenti's picture

Përshëndetje sokolnushaj,

ke provuar të kalosh pozicionin (PATH) e plotë të script-it në tabelën e cron? (Sado i zgjuar të jetë, nuk besoj që arrin të kuptojë ku gjendet ~/bin/.... )

Pa u futur në detajet e script-it apo të opsioneve të cron, instruksioni korrekt do të ishte (pa "sudo", mund ta përdorësh si përdorues i zakonshëm):

#script to record record_aLive $
* * * * * /home/sn0m/bin/record_aLive