mirror of
https://github.com/narkoz/hacker-scripts
synced 2025-08-23 19:07:33 +00:00
Update cron job to be executed on weekdays only
Updated the cron job so that it only executes the scripts on weekdays, that way there is not need to check for this condition inside the scripts, updated the scripts as well
This commit is contained in:
parent
47e8900c37
commit
b9c6dad2c5
12
README.md
12
README.md
@ -42,17 +42,17 @@ For Ruby scripts you need to install gems:
|
|||||||
## Cron jobs
|
## Cron jobs
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Runs `smack-my-bitch-up.sh` daily at 9:20 pm.
|
# Runs `smack-my-bitch-up.sh` monday to friday at 9:20 pm.
|
||||||
20 21 * * * /path/to/scripts/smack-my-bitch-up.sh >> /path/to/smack-my-bitch-up.log 2>&1
|
20 21 * * 1-5 /path/to/scripts/smack-my-bitch-up.sh >> /path/to/smack-my-bitch-up.log 2>&1
|
||||||
|
|
||||||
# Runs `hangover.sh` daily at 8:45 am.
|
# Runs `hangover.sh` monday to friday at 8:45 am.
|
||||||
45 8 * * * /path/to/scripts/hangover.sh >> /path/to/hangover.log 2>&1
|
45 8 * * 1-5 /path/to/scripts/hangover.sh >> /path/to/hangover.log 2>&1
|
||||||
|
|
||||||
# Runs `kumar-asshole.sh` every 10 minutes.
|
# Runs `kumar-asshole.sh` every 10 minutes.
|
||||||
*/10 * * * * /path/to/scripts/kumar-asshole.sh
|
*/10 * * * * /path/to/scripts/kumar-asshole.sh
|
||||||
|
|
||||||
# Runs `fucking-coffee.sh` hourly from 9am to 6pm.
|
# Runs `fucking-coffee.sh` hourly from 9am to 6pm on weekdays.
|
||||||
0 9-18 * * * /path/to/scripts/fucking-coffee.sh
|
0 9-18 * * 1-5 /path/to/scripts/fucking-coffee.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
# Skip on weekends
|
|
||||||
exit if Time.now.saturday? || Time.now.sunday?
|
|
||||||
|
|
||||||
# Exit early if no sessions with my username are found
|
# Exit early if no sessions with my username are found
|
||||||
exit unless `who -q`.include? ENV['USER']
|
exit unless `who -q`.include? ENV['USER']
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
# Skip on weekends
|
|
||||||
exit if Time.now.saturday? || Time.now.sunday?
|
|
||||||
|
|
||||||
# Exit early if sessions with my username are found
|
# Exit early if sessions with my username are found
|
||||||
exit if `who -q`.include? ENV['USER']
|
exit if `who -q`.include? ENV['USER']
|
||||||
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
DAYOFWEEK=$(date +%u)
|
|
||||||
|
|
||||||
# Skip on weekends
|
|
||||||
if [ "$DAYOFWEEK" -eq 6 ] || [ "$DAYOFWEEK" -eq 7 ]; then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Exit early if any session with my username is found
|
# Exit early if any session with my username is found
|
||||||
if who | grep -wq $USER; then
|
if who | grep -wq $USER; then
|
||||||
exit
|
exit
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import datetime
|
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import telnetlib
|
import telnetlib
|
||||||
import time
|
import time
|
||||||
|
|
||||||
today = datetime.date.today()
|
|
||||||
|
|
||||||
# skip weekends
|
|
||||||
if today.strftime('%A') in ('Saturday', 'Sunday'):
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
# exit if no sessions with my username are found
|
# exit if no sessions with my username are found
|
||||||
output = subprocess.check_output('who')
|
output = subprocess.check_output('who')
|
||||||
if 'my_username' not in output:
|
if 'my_username' not in output:
|
||||||
|
@ -1,18 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import datetime
|
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from twilio.rest import TwilioRestClient
|
from twilio.rest import TwilioRestClient
|
||||||
from time import strftime
|
from time import strftime
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
today = datetime.date.today()
|
|
||||||
|
|
||||||
# skip weekends
|
|
||||||
if today.strftime('%A') in ('Saturday', 'Sunday'):
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
# exit if sessions with my username are found
|
# exit if sessions with my username are found
|
||||||
output = subprocess.check_output('who')
|
output = subprocess.check_output('who')
|
||||||
if 'my_username' in output:
|
if 'my_username' in output:
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import datetime
|
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from twilio.rest import TwilioRestClient
|
from twilio.rest import TwilioRestClient
|
||||||
@ -8,13 +7,6 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from time import strftime
|
from time import strftime
|
||||||
|
|
||||||
|
|
||||||
today = datetime.date.today()
|
|
||||||
|
|
||||||
# skip weekends
|
|
||||||
if today.strftime('%A') == 'Saturday' || today('%A') == 'Sunday':
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
# exit if no sessions with my username are found
|
# exit if no sessions with my username are found
|
||||||
output = subprocess.check_output('who')
|
output = subprocess.check_output('who')
|
||||||
if 'my_username' not in output:
|
if 'my_username' not in output:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import datetime
|
|
||||||
import telnetlib
|
import telnetlib
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -13,10 +12,6 @@ COFFEE_MACHINE_PROM = 'Password: '
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Skip on weekends.
|
|
||||||
if datetime.date.today().weekday() in (0, 6,):
|
|
||||||
return
|
|
||||||
|
|
||||||
# Exit early if no sessions with my_username are found.
|
# Exit early if no sessions with my_username are found.
|
||||||
if not any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')):
|
if not any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')):
|
||||||
return
|
return
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import datetime
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from twilio import TwilioRestException
|
from twilio import TwilioRestException
|
||||||
@ -18,10 +17,6 @@ LOG_FILE_PATH = get_log_path('hangover.txt')
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Skip on weekends.
|
|
||||||
if datetime.date.today().weekday() in (0, 6,):
|
|
||||||
return
|
|
||||||
|
|
||||||
# Exit early if any session with my_username is found.
|
# Exit early if any session with my_username is found.
|
||||||
if any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')):
|
if any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')):
|
||||||
return
|
return
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import datetime
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from twilio import TwilioRestException
|
from twilio import TwilioRestException
|
||||||
@ -18,10 +17,6 @@ LOG_FILE_PATH = get_log_path('smack_my_bitch_up.txt')
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Skip on weekends.
|
|
||||||
if datetime.date.today().weekday() in (0, 6,):
|
|
||||||
return
|
|
||||||
|
|
||||||
# Exit early if no sessions with my_username are found.
|
# Exit early if no sessions with my_username are found.
|
||||||
if not any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')):
|
if not any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')):
|
||||||
return
|
return
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
DAYOFWEEK=$(date +%u)
|
|
||||||
|
|
||||||
# Skip on weekends
|
|
||||||
if [ "$DAYOFWEEK" -eq 6 ] || [ "$DAYOFWEEK" -eq 7 ]; then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Exit early if no sessions with my username are found
|
# Exit early if no sessions with my username are found
|
||||||
if ! who | grep -wq $USER; then
|
if ! who | grep -wq $USER; then
|
||||||
exit
|
exit
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
# Skip on weekends
|
|
||||||
exit if Time.now.saturday? || Time.now.sunday?
|
|
||||||
|
|
||||||
# Exit early if no sessions with my username are found
|
# Exit early if no sessions with my username are found
|
||||||
exit if `who -q`.include? ENV['USER']
|
exit if `who -q`.include? ENV['USER']
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user