Can't start the clean-up script?

I have been trying but I can’t start the file.

I have tried:
sudo ./

This is the error message I get:

sudo: ./ command not found

Here is my file:


# Uncomment the following line if you rather want to run the script manually.
# Display usage if the script is not run as root user
        if [[ $USER != "root" ]]; then
                echo "This script must be run as root user!"
                exit 1
echo "Super User detected!!"
read -p "Press [ENTER] to start the procedure, this will stop the seafile server!!"

# stop the server
echo Stopping the Seafile-Server...
/etc/systemd/system/seafile.service stop

echo Giving the server some time to shut down properly....
sleep 10

# run the cleanup
echo Seafile cleanup started...
sudo -u seafile /homex/xxx/xx/seafile-server-latest/ -r

echo Giving the server some time....
sleep 3

# start the server again
echo Starting the Seafile-Server...
/etc/systemd/system/seafile.service start

echo Seafile cleanup done!

That is the basic of my script with systemd (I did not write it).
You you start and stop the services and does the user Seafile exist?

What permission does the script have?

yes, I have change it to systemd as that’s where I have the startup script service according to seafile manual how to write it.
The script have user premission, yes the seafile user exist.

Try bash ./ or sudo bash ./

The script needs execution rights: chmod +x /path/to/

Hi again @DerDanilo
I did try bash and it worked but I was given multi error messages:

Super User detected!!
Press [ENTER] to start the procedure, this will stop the seafile server!!
Stopping the Seafile-Server...
sudo: /etc/systemd/system/seafile.service: command not found
Giving the server some time to shut down properly....

Seafile cleanup started...

seafile server is still running, stop it by " stop"

Giving the server some time....
Starting the Seafile-Server...
./ line 31: /etc/systemd/system/seafile.service: Permission denied
Seafile cleanup done!

When I was setting up the auto-startscript I was following this guide:

And my autostart works, but as you can see it’s in the systemd folder.

You should rather use systemctl stop seafile.service and systemctl start seafile.service

My current setup is not with systemd, so you need to add the following to the script:
systemctl stop seahub.service and systemctl start seahub.service

Google is your friend:

1 Like

a quastion regarding this old topic, do I really need to run it with sudo command?
I did try to run the -r with only ./ -r and I did get this:

Starting seafserv-gc, please wait …
[10/30/17 07:29:39] gc-core.c(384): === Repos deleted by users ===
[10/30/17 07:29:39] gc-core.c(392): GC deleted repo 73695e16.
[10/30/17 07:29:40] gc-core.c(392): GC deleted repo 6c280379.
[10/30/17 07:29:40] gc-core.c(392): GC deleted repo 168acfb9.
seafserv-gc run done

It seems that it will work without the sudo command.

nvm see the note above.