at
Run a job for a specific time.
AT(1) BSD General Commands Manual
NAME
at, batch, atq, atrm -- queue, examine, or delete jobs for later execution
github
- The jupyter notebook format file on github is here .
google colaboratory
- To run it in google colaboratory here at_nb.ipynb)
Environment
The author’s OS is macOS, and the options are different from those of Linux and Unix commands.
When you actually run the command, you should not use the leading ! and %%bash in the first line.
!sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G95
!bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
Example usage
Usually, I use the -f and -t options.
Prepare a bash file like the following.
%%bash
cat << 'EOF' > temp.sh
#! /bin/bash
echo `date +%Y%m%d
EOF
chmod +x temp.sh
! ls -al
total 32
drwxr-xr-x 7 hiroshi staff 224 7 8 17:26 [34m.[m[m
drwxr-xr-x 25 hiroshi staff 800 7 8 17:13 [34m. [m[m
drwxr-xr-x 3 hiroshi staff 96 7 8 17:14 [34m.ipynb_checkpoints[m[m
-rw-r--r-- 1 hiroshi staff 4094 7 8 17:26 at_nb.ipynb
-rw-r--r-- 1 hiroshi staff 2005 7 8 17:26 at_nb.md
-rw-r--r-- 1 hiroshi staff 1469 7 8 17:26 at_nb.py
-rwxr-xr-x 1 hiroshi staff 34 7 8 17:26 [31mtemp.sh[m[m
! /temp.sh
20200708
To make this file run at 18:00 on July 8, 2020, run the following command. This can be used like a timer, so if you want to use it temporarily, it is easier than setting CRON.
%%bash
at -f temp.sh.sh -t 202007081800
Typical options
- f : specifies a file
- t : Defines the time format (YYYYmmddHHMM)