Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # traemos el fichero de funciones
- source funciones
- # Parametros
- arr_params=( $1 $2 )
- cron_dir="/var/spool/cron/crontabs"
- cron_tab="0 1 * * * /bin/false"
- user="${arr_params[1]}"
- case ${arr_params[0]} in
- -h|--h)
- func_help
- exit
- ;;
- -c)
- if ! func_root ;then
- func_help
- exit 1
- elif ! func_user $user; then
- exit 1
- else
- echo "$cron_tab" >> $cron_dir/${arr_params[1]}
- fi
- ;;
- -d)
- if func_root ;then
- rm $cron_dir/${arr_params[1]}
- else
- func_help
- exit 1
- fi
- ;;
- -i)
- cat $cron_dir/${arr_params[1]}
- ;;
- *)
- echo "No se paso niguna opcion válida o el usuario no existe"
- exit 1
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement