Thread: Need Help running cron as root
i have external usb hard drive spins down every 10 min. commands in 'hdparm' nothing override internal settings. so, wrote script touch file every 5 minutes, , run root because of mount command, , want run every user. script executable, owned root, , root group, 755 permissions.
no_sleep.sh in /usr/sbin:
in terminal, i've editted crontab root by:code:#!/bin/bash # script keep external drive spinning down diskmounted=$(mount | grep backup | wc -c) if [ $diskmounted -gt 0 ] touch /mnt/backup/.nosleep fi
this looks like:code:sudo crontab -e -u root
i'm not getting hidden file .nosleep in /mnt/backup, or output desktop asked. doing wrong?code:#keep external hd spinning down touching file every 5 min */5 * * * * root /usr/sbin/no_sleep.sh > ~/desktop/no_sleep_test.txt
you don't need -u option, since sudo implies "root":
try (replace "your_username"):code:sudo crontab -e
also, "sdparm" command might let change drive's settings. may need install it.code:*/5 * * * * /usr/sbin/no_sleep.sh >/home/your_username/desktop/no_sleep_test.txt 2>&1
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help Need Help running cron as root
Ubuntu
Comments
Post a Comment