at command

how to use at command:

1. ユーザー切替(実行ユーザーに切替)
   su - ftpuser
2. command 登録、リスト表示、内容表示、登録削除
[ftpuser@host01 ~]$ at  14:02 11/18/2019
at> cd /tmp;echo “who:$(whoami)” >test_$(date “+%Y%m%d%H%M%S”).log ←ctrl + D to end entry
job 1275 at Mon Nov 18 14:02:00 2019
[ftpuser@host01 ~]$ ls -l /tmp/test*.log   ←実行結果
-rw-r--r-- 1 ftpuser ftpgrp 12 11月 18 14:02 /tmp/test_20191118140200.log
[ftpuser@host01 ~]$ cat /tmp/test_20191118140200.log
who:ftpuser
[ftpuser@host01 ~]$
[ftpuser@host01 ~]$ at -l    ←リスト表示
1275    Mon Nov 18 14:02:00 2019 a ftpuser
[ftpuser@host01 ~]$ at -c 1275 | grep -A2 SHELL  ←内容表示(grep以下は必要情報抜き出し用)
SHELL=/bin/bash; export SHELL
HISTSIZE=500; export HISTSIZE
USER=ftpuser; export USER
--
${SHELL:-/bin/sh} << ‘marcinDELIMITER7e33b7d4’
cd /tmp;echo “who:$(whoami)” >test_$(date “+%Y%m%d%H%M%S”).log
marcinDELIMITER7e33b7d4
[ftpuser@host01 ~]$
[ftpuser@host01 ~]$ at -d 1275   ←登録削除
[ftpuser@host01 ~]$ at -l
[ftpuser@host01 ~]$

コメント

人気の投稿