Skip to content
Snippets Groups Projects
Commit 49c4de33 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Merge branch 'feat-disable-crontab-script' into 'main'

FEAT: introduce shell script to allow user to disable another users crontab...

See merge request !158
parents a93b8ea1 cb80c0d3
No related branches found
No related tags found
1 merge request!158FEAT: introduce shell script to allow user to disable another users crontab...
Pipeline #14511 passed with stage
in 11 minutes and 22 seconds
#!/bin/bash
usage() {
echo "Usage: $0 -d USERNAME to disable a user"
echo "Usage: $0 -e USERNAME to re-enable a user"
}
if [[ "$EUID" -ne 0 ]]; then
echo "This script must be run as root!"
exit 1
fi
if [ "$#" -eq 0 ]; then
usage
exit 1
fi
while getopts ':d:e:' OPTION; do
case $OPTION in
d)
mv /var/spool/cron/$OPTARG /var/spool/cron/$OPTARG.disabled
echo $OPTARG >>/etc/cron.deny
;;
e)
mv /var/spool/cron/$OPTARG.disabled /var/spool/cron/$OPTARG
sed -i -e "/$OPTARG/d" /etc/cron.deny
;;
esac
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment