Hi there, I’ve found a strange issue, maybe somebody has solved it.
I need to run seaf-gc.sh often, because my library sync a huge file that keeps evolving.
Now if I run seaf-gc.sh either manually with user seafile and from the script (posted below) with user root it runs great and frees the space I need.
But if I run it in crontab (root crontab) it doesn’t run.
Here is the cronjob I run: 0 1 * * * /script/seafile_cleanup.sh
And the seafile_cleanup.sh script:
#!/bin/bash
##########
echo "Registering space BEFORE script"
echo "BEFORE" >> /script/seafile_cleanup.sh.log
date >> /script/seafile_cleanup.sh.log
df -h /dev/vda >> /script/seafile_cleanup.sh.log
service seafile-server stop
sleep 20
su seafile -c "/home/seafile/seafile-server-latest/seaf-gc.sh"
sleep 10
service seafile-server start
echo "Registering space AFTER script..."
echo "AFTER" >> /script/seafile_cleanup.sh.log
date >> /script/seafile_cleanup.sh.log
df -h /dev/vda >> /script/seafile_cleanup.sh.log
echo "" >> /script/seafile_cleanup.sh.log
echo "" >> /script/seafile_cleanup.sh.log
Cool. Could you give an example how you extended the script(s) to work properly?
I was thinking of writing a systemd unit to execute gc and have it start and stop properly.
But currently I have no time for seafile CE work.
If you type env you’ll see the corresponding path of your system (which might differ from system to system).
This is just a crontab issue, since many bash scripts doesn’t work in crontab, but with this fix they should.