I'm having a problem in linux. I'm using transmisison-daemon which starts as a service. The external disk to which transmisison daemon writes/reads to is mounted through fstab. I thought fstab mounts the disk during boot, so it should be easy for transmission to see the external disk when it starts.
But it seems, transmission daemon either starts before the disk is mounted to /mnt or that fstab mounts the disk to /mnt after linux boots up.
So I tried putting a sleep parameter in transmission daemon init file. I put sleep = 50 (for sleep = 50 seconds). It doesn't work for some reason.
I tried to think of ways to counter this and came up with 2 ways.
1 - put a script in my home folder that runs as soon as linux boots. The script will just stop transmission daemon.
After a 30 second delay, the script will start transmission daemon again.
2 - mount the drive in transmission-daemon script.
could i use mount -a in the beginning of the script? It should mount the disk right? If the script does mount the disk, will fstab throw any error?
Another option would be to put a function in beginning of transmisison-daemon script that checks whether the drive is mounted. But if there are 2 or more drives, it won't look good. Also I don't like this way since the file could be over written if the program gets updated in future.
Is there another way to do this?
But it seems, transmission daemon either starts before the disk is mounted to /mnt or that fstab mounts the disk to /mnt after linux boots up.
So I tried putting a sleep parameter in transmission daemon init file. I put sleep = 50 (for sleep = 50 seconds). It doesn't work for some reason.
I tried to think of ways to counter this and came up with 2 ways.
1 - put a script in my home folder that runs as soon as linux boots. The script will just stop transmission daemon.
After a 30 second delay, the script will start transmission daemon again.
Code:
#!/bin/bash
sudo service transmission-daemon stop
sleep = 30
sudo service transmision-daemon start
exit
2 - mount the drive in transmission-daemon script.
could i use mount -a in the beginning of the script? It should mount the disk right? If the script does mount the disk, will fstab throw any error?
Another option would be to put a function in beginning of transmisison-daemon script that checks whether the drive is mounted. But if there are 2 or more drives, it won't look good. Also I don't like this way since the file could be over written if the program gets updated in future.
Is there another way to do this?