I was not able to find the "at" command in PhotonOS.
Is there another similar tool available or is it located in a specific repository ?
To schedule a bash file to automatically run once eg. after a reboot, you could use this, see https://vmware.github.io/photon/assets/files/html/3.0/photon_admin/creating-a-startup-service.html.
Generally, you must create a service file in which you declare what has to be done as "at" one. In the following sample it is simply a bash file which is configured to run once.
# --- 1) create a bash file with content as preparation for the service (see 2). The last part in the bash file direclty disables and unlinks the service.
cat > $BASHFILE <<'EOF'
# INSERT YOUR CODE
systemctl disable mysample.service
# --- 2) make the bash file executable and create the service file. The type of [Service] is configured to 'oneshot'. The Unit dependencies 'after' and 'wants' - in this case- it has a environment dependency to a service called waagent.service. This is optional.
chmod a+x $BASHFILE
cat << EOF1 >> /lib/systemd/system/mysample.service
Description=Run a bash file
ln -s ../mysample.service mysample.service
# --- 3) 'ln -s' together with the service file allows to simply use the created service within systemctl.
Hope this helps.
Thanks for your answer.
It is not a convenient solution, as I would like to be able to run a background task without any shell at a desired time and on demand. So no need to configure a cron and forget to unset it for a single-shot maintenance script which must be run in a middle of the night to solve a problem (my typical recurring need).
If the "at" command is definitely unavailable in Photon OS, I am quite surprised as it is very common in the Linux world and not fancy !
@INSASBGDSIN Photon supports several flavors generic, linux-esx, aws,.You could place your question on Issues · vmware/photon · GitHub why the scheduling algorithm of at_irq.c (?) didn't made it to be kept as one of the affordable scheduling methods. cron is a supported old fallback within systemd though.