Skip to content
Snippets Groups Projects
Commit c6c49f81 authored by Chris Croome's avatar Chris Croome
Browse files

added check to see if the cron script is being run via cron

parent 10e74cee
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
if [[ "${USER}" != "{{ item }}" ]]; then
echo "This script should be run as {{ item }}, please sudo first"
echo "sudo -u {{ item }} -s /bin/bash"
echo "${0}"
exit
# $LOGNAME is set to {{ item }} when this script is run via cron and is
# unset when run via a terminal
if [[ "${LOGNAME}" != "{{ item }}" ]]; then
if [[ "${USER}" != "{{ item }}" ]]; then
echo "This script should be run as {{ item }}, please sudo first"
echo "sudo -u {{ item }} -s /bin/bash"
echo "${0}"
exit
fi
fi
cd ~/sites
......
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