J’essaie de programmer un registrement de l’entrée ligne de ma carte son.
Pour l’enregistrement j’utilise arecord. La commande fonctionne bien en direct :
arecord -f cd -d 10 /mnt/dd1/Musique/test.wav
Par contre je voudrais pouvoir la programmer via crontab et là ça coince. J’ai essayer plusieurs configuration mais rien :
J’ai essayer en créant un script *.sh avec la commande et de lancer le script via crontab, rien non plus. Même en copiant le script dans /usr/local/bin
Le script fonctionne en direct.
Ci-dessous le fichier crontab :
#edit this file to introduce tasks to be run by cron.
#
#Each task to run has to be defined through a single line
#indicating with different fields when the task will be run
#and what command to run for the task
#
#To define the time you can provide concrete values for
#minute (m), hour (h), day of month (dom), month (mon),
#and day of week (dow) or use '*' in these fields (for 'any').
#
#Notice that tasks will be started based on the cron's system
#daemon's notion of time and timezones.
#
#Output of the crontab jobs (including errors) is sent through
#email to the user the crontab file belongs to (unless redirected).
#
#For example, you can run a backup of all your user accounts
#at 5 a.m every week with:
#0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
#For more information see the manual pages of crontab(5) and cron(8)
#
#m h dom mon dow command
14 11 * * * /usr/bin/arecord -f cd -d 10 /mnt/dd1/Musique/test.wav
Pour une commande avec de multiples arguments, appeler un script est plutôt une bonne idée.
Appeler le script avec son chemin absolu est préférable voire requis.
Comment ça ? Je ne comprends pas.
Il n’y a pas besoin de privilège root pour faire ce que tu veux.
Tu utilises bien
crontab -e
pour établir ta planification ?
11 h 14 mn, c’est une fois par jour.
Pour éviter le risque d’une sortie standard dangereuse lors d’une commande planifiée cron
J’utilise &> /dev/null à la fin de mes commandes planifiées.
En fait j’avais trouver sur G**gle que l’on pouvait ajouter le user après les variables de temps. Mais là ça ne marchait pas. J’aurai pensé qu’en mettant le user, cron aurait chargé l’ensemble des
variables d’environnement de l’user mentionné.
oui
J’ai trouver la solution il faut rajouter une variable d’environnement dans la table cron :
Par exemple dans mons cas pour ce soir :
00 21 2 6 * XDG_RUNTIME_DIR=/run/user/1000 /usr/bin/arecord -f cd -d 11000 /mnt/dd1/Musique/190602_WeLoveGreen.wav