cpanel or even ssh access won't help you here, as Elastic Beanstalk is allowed to replace your server instances as it see fit. This means that if you use cpanel, your changes will be lost in the next time EB decides to spin up a new server.
Now in order to ensure your cron is properly populated, you'd need to use the .ebextensions mechanism. It's a small script that is run when a new server spins up, and can populate your cron.
Here're the steps to introduce such a script:
- create a /.ebextensions folder in the root of your project
- create the file /.ebextension/populate_cron.config
- enter the following text into that file:
container_commands:
populate_cron:
command: crontab -l | { cat; echo "0 0 0 0 0 your command"; } | crontab -
leader_only: true
(note that this is a yaml file, so keep the indentation as is)
- commit this file and
eb deploy
- after the env is up,
eb ssh
to see that the cron is there