the script works randomly; it writes a few bytes to the file and stop working.
The dfhome.sh script is:
!/bin/sh
while true ; do
/bin/date >> /home/vbr/service/disk_space_report.txt
/usr/bin/du -sh /home/ >> /home/vbr/service/disk_space_report.txt
/bin/sleep 15
done
I have tried to set the stdout to the file and replace the redirection from the script, but it not works.
However, if I exec the script directly without daemonizing it (...ExecStart=/home/vbr/service/dfhome.sh
..) , it works ok. But I prefer to daemonize in order to close files, run in background, dissasociate from terminal, etc.
Hello,
When I try to daemonize a script from a systemd service:
[Unit] After=network.target [Service] ExecStart=/home/vbr/daemonize/daemonize /home/vbr/service/dfhome.sh [Install] WantedBy=default.target
the script works randomly; it writes a few bytes to the file and stop working.
The dfhome.sh script is:
!/bin/sh
while true ; do /bin/date >> /home/vbr/service/disk_space_report.txt /usr/bin/du -sh /home/ >> /home/vbr/service/disk_space_report.txt /bin/sleep 15 done
I have tried to set the stdout to the file and replace the redirection from the script, but it not works.
However, if I exec the script directly without daemonizing it (...ExecStart=/home/vbr/service/dfhome.sh ..) , it works ok. But I prefer to daemonize in order to close files, run in background, dissasociate from terminal, etc.
Thank you.
Regards, Vic.