Filebrowser: Run in Start

Created on 4 Jul 2018  路  5Comments  路  Source: filebrowser/filebrowser

Hi,

Please, we are using Filemanager for a small community needs.

We installed Filemanager in Ubuntu, but we need to launch it every time we want to use it; How can it be launched everytime?

Thank's

duplicate 馃摐

Most helpful comment

Here's the way I did it with a systemd service.

_nano /etc/systemd/system/filebrowser.service_

[Unit]
Description=Filebrowser
After=network-online.target

[Service]
User=root
Group=root

ExecStart=/usr/local/bin/filebrowser -r /

[Install]
WantedBy=multi-user.target

_systemctl start filebrowser
systemctl enable filebrowser_

P.S. this would be a dangerous setup if your filebrowser is accessible via the public internet. In my case it is only listening on the private network.

All 5 comments

Hi @karim2001! Please, have a look at #411 and #418.

Also, if you use the docker image and launch a container with --restart always, every time the docker daemon is started the container will be started too. To have the docker daemon started on startup, you can enable it with sudo systemctl enable docker. For further info: https://docs.docker.com/config/daemon/systemd/

I created a systemd service for filebrowser. Works perfectly. Check Method 4 in https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/

Closed in favour of filebrowser/filebrowser.github.io#5.

@karim2001 probably too late on this but we simply kept this running by running this script in cron every minute

put the below in a file filebrowseractive.sh
then add to cron every minute

# Run Filebrowser if not running

LOG="/root/filebrowser.log.`date +%d%m%Y`"

echo "Delete log files older than 9 days" >>$LOG
                /usr/bin/find /root/filebrowser.log.* -type f -mtime +9 -exec rm -v {} \; 

echo "`date`" >>$LOG


FILEBROWSER=`ps -s |grep  'filebrowser --port 80' | wc -l`
echo "$FILEBROWSER"

 if [ $FILEBROWSER -gt 1 ]
        then
               echo "running"


        else
                echo "not running"
                /usr/local/bin/filebrowser --port 80 -a x.x.x.x -r /root/recordings/
 fi
echo "Finish `date`" >>$LOG

x.x.x.x = IP address of box running

Probably not the prettiest, but it works :)

Here's the way I did it with a systemd service.

_nano /etc/systemd/system/filebrowser.service_

[Unit]
Description=Filebrowser
After=network-online.target

[Service]
User=root
Group=root

ExecStart=/usr/local/bin/filebrowser -r /

[Install]
WantedBy=multi-user.target

_systemctl start filebrowser
systemctl enable filebrowser_

P.S. this would be a dangerous setup if your filebrowser is accessible via the public internet. In my case it is only listening on the private network.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SJ50 picture SJ50  路  5Comments

Marneus68 picture Marneus68  路  6Comments

aoceano picture aoceano  路  4Comments

chanyk-joseph picture chanyk-joseph  路  4Comments

the-eric-kwok picture the-eric-kwok  路  5Comments