Can't get a script to run on starting an ec2 ubuntu server - Ask Ubuntu


so have ec2 instance setup, in order work way i'd to, need execute script every time ec2 instance started, life of me cannot script start when start instance. ec2 instance ubuntu server 16, here's i've tried far

  • adding @reboot /path/to/myscript.sh crontab root user
  • adding myscript.sh /etc/init.d folder /etc/init folder
  • adding /path/to/myscript.sh rc.local
  • copying script /var/lib/cloud/scripts/per-boot

manually executing script root work perfectly, none of above methods has worked me, i'm not sure possibly missing here.

if matters, i'm trying accomplish use yas3fs mount s3 bucket fs /mnt contain media. unfortunately yas3fs doesn't work in fstab, need execute mounting command script.

first, make sure file executable. set execute permission on script:

chmod +x /path/myscript.sh 

enable logs : out exact problem.

@reboot /path/to/myscript.sh > /path/cronlog.log 2>&1 

Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User