![]() |
|
Guides All Guides and HOWTO's. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
Many are familiar with cron(8) to schedule jobs for execution in the future and/or at regular intervals.
Quote:
Code:
NAME at, batch - queue, examine or delete jobs for later execution A simple example, using 'stdin', to have it execute echo Hello ; ls -l ; echo Done with ls! at about three minutes from now:Code:
nedrag# echo 'echo Hello ; ls -l ; echo Done with ls!' | at + 3 minutes commands will be executed using /bin/ksh job 1620879120.c at Thu May 13 06:12:00 2021 Code:
nedrag# at -l 1620879120.c Thu May 13 06:12:00 2021 Code:
nedrag# at -c 1620879120.c #!/bin/sh # atrun uid=0 gid=66 # mail adriaan 0 umask 22 export LOGNAME=root export HOME=/root export OLDPWD=/root/.ssh export PWD=/root export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin export USER=root cd /root || { echo 'Execution directory inaccessible' >&2 exit 1 } /bin/ksh << '_END_OF_AT_JOB' echo Hello ; ls -l ; echo Done with ls! _END_OF_AT_JOB Code:
Date: Thu, 13 May 2021 06:12:01 +0200 (CEST) From: Atrun Service <root@nedrag.siralas.nl> To: adriaan@nedrag.siralas.nl Subject: Output from "at" job Your "at" job on nedrag.siralas.nl "/var/cron/atjobs/1620879120.c" produced the following output: Hello total 380 -rw-r--r-- 1 root wheel 87 Apr 19 18:16 .Xdefaults -rw-r--r-- 1 root wheel 578 Apr 19 18:16 .cshrc -rw-r--r-- 1 root wheel 94 Apr 19 18:16 .cvsrc -rw-r--r-- 1 root wheel 104 May 13 03:43 .exrc -rw-r--r-- 1 root wheel 8 May 11 23:55 .forward -rw-r--r-- 1 root wheel 328 Apr 19 18:16 .login -rw-r--r-- 1 root wheel 526 May 13 03:27 .profile Done with ls! Code:
nedrag# cat MySSHinstuders.cmd ls -l /var/log/authlog echo ---------------------------- grep 'Invalid user' /var/log/authlog | awk '{ print $3, $8, $10, $11, $12 }' | column -t Code:
nedrag# at -f MySSHinstuders.cmd +3 minutes commands will be executed using /bin/ksh job 1620882180.c at Thu May 13 07:03:00 2021 Code:
nedrag# at -c 1620882180.c #!/bin/sh # atrun uid=0 gid=66 # mail adriaan 0 umask 22 export LOGNAME=root export HOME=/root export OLDPWD=/root/.ssh export PWD=/root export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin export USER=root cd /root || { echo 'Execution directory inaccessible' >&2 exit 1 } /bin/ksh << '_END_OF_AT_JOB' ls -l /var/log/authlog echo --------------------------- grep 'Invalid user' /var/log/authlog | awk '{ print $3, $8, $10, $11, $12 }' | column -t _END_OF_AT_JOB Code:
Date: Thu, 13 May 2021 07:03:01 +0200 (CEST) From: Atrun Service <root@nedrag.siralas.nl> To: adriaan@nedrag.siralas.nl Subject: Output from "at" job Your "at" job on nedrag.siralas.nl "/var/cron/atjobs/1620882180.c" produced the following output: -rw-r----- 1 root wheel 27842 May 13 05:11 /var/log/authlog --------------------------- 01:00:23 tesco 193.112.127.245 port 34052 01:00:28 eaglewiz 39.109.116.175 port 41606 01:01:07 mfu 103.72.172.20 port 36002 01:01:40 cele 39.109.116.175 port 56122 01:02:10 admin 1.226.12.132 port 58152 01:02:51 msda 132.232.105.237 port 38760 01:02:57 oracle 138.68.139.104 port 44682 01:03:22 chenqn 193.112.127.245 port 41462 01:07:17 splunk 177.234.172.10 port 57536 01:07:50 http 103.72.172.20 port 54996 01:08:49 lava2 138.68.139.104 port 35004 01:09:04 fancong 1.226.12.132 port 57830 01:09:13 fancong 132.232.105.237 port 57392 01:09:27 thinker 193.112.127.245 port 56292 01:09:48 gymnast 103.73.102.247 port 50788 01:10:16 zhangn 177.234.172.10 port 40452 01:10:23 karl 3.24.138.187 port 58120 01:11:21 neww 1.226.12.132 port 38900 01:12:21 liq 103.72.172.20 port 39432 01:12:24 debian 193.112.127.245 port 35482 01:12:29 prueba1 132.232.105.237 port 38512 01:13:01 javier 177.234.172.10 port 51572 01:14:31 neww 103.72.172.20 port 45778 01:14:40 derek 138.68.139.104 port 53558 01:15:25 ellen 193.112.127.245 port 42898 01:15:48 mfu 132.232.105.237 port 47832 01:16:46 bobby 103.72.172.20 port 52122 01:17:11 oracle 103.73.102.247 port 37120 01:18:13 dhou 1.226.12.132 port 38580 01:18:43 wwwrun 177.234.172.10 port 45606 01:18:56 zhaoqiqi 132.232.105.237 port 57158 01:19:01 pt 103.72.172.20 port 58466 01:20:34 chenph 1.226.12.132 port 47878 01:20:42 paula 138.68.139.104 port 43882 01:21:17 testbelkofsi 103.72.172.20 port 36580 01:21:17 testbelkofsi 103.72.172.20 port 36580 01:21:25 xqh 193.112.127.245 port 57726 Have fun with the Unix way to get things done ![]()
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 13th May 2021 at 06:08 AM. |
![]() |
Tags |
at(1), cron, crontab |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Why Bad Jobs (or No Jobs) Happen To Good Workers | ocicat | News | 3 | 22nd June 2012 04:56 PM |
RIP Steve Jobs (1955-2011) | Beastie | News | 1 | 6th October 2011 01:33 PM |
Steve Jobs resigns as CEO of Apple. | fossala | News | 0 | 25th August 2011 07:53 AM |
Google mocks Steve Jobs with Chrome-Flash merger | J65nko | News | 2 | 26th April 2010 01:51 PM |