The command line admin option for putting moodle into maintenance mode is really useful
https://docs.moodle.org/25/en/Administration_via_command_line#Maintenance_mode
$ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable
but does anyone know if it's possible to get this command to run inside a linux bash script so I can schedule it to happen later at night? My problem is that when I run it I get an error saying that its using 'unrecognized options' which suggests that the --enable option isn't being passed to the php script. Is there some way of getting this working?