Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LionHeartBlue's avatar

Running commands on Server Startup

Hi all,

I have set up some servers on Forge, and have used fuse-s3fs to mount an AWS S3 Bucket to a Folder.

I need to add the mount command to the startup scripts (the documentation says /etc/rc.local) but I cannot find this or where to add this command on a Forge Created server.

Any help is much appreciated.

0 likes
6 replies
Sinnbeck's avatar

Are you able to ssh into your forge server? If so you need to ssh into the server to do this

sudo nano /etc/rc.local

Another solution would be to add a cron job that only runs on startup (in case you already know how to add a cronjob for your user)

Start crontab -e and add

@reboot  /path/to/script
LionHeartBlue's avatar

Thanks, @sinnbeck for your reply. Don't think I explained my problem very well. On my servers that have been set up by Forge, the /etc/rc.local file doesn't exist.

So I am thinking that Forge uses a different folder structure for this stuff and I don't know where that is.

However, I might be able to use your second suggestion, so thanks very much. Will give that a try.

LionHeartBlue's avatar

@wilk_randall, I have created the script but at the moment I am facing a similar issue. Crontab doesn't seem to be used in the same way for Forge setups.

Using the Forge Daemon UI I don't get an option to enter

@reboot 

.....at least, not obviously.

LionHeartBlue's avatar
LionHeartBlue
OP
Best Answer
Level 7

I managed to solve my problem in the end, by editing /etc/fstab and adding the following line to it:

s3fs#my-bucket-name /home/forge/website/path/to/local/folder fuse _netdev,allow_other 0 0
munger's avatar
  1. create and save your /etc/rc.local file
  2. make the file executable sudo chmod +x /etc/rc.local
  3. reboot to test and if it's not doing your thing check here for errors: sudo systemctl status rc.local.service

Please or to participate in this conversation.