Answer the question
In order to leave comments, you need to log in
How to run a function in bash from the command line?
The script has a function:
Autobak(){
zip -r openvpn.zip /etc/openvpn
backupURL="$(curl -F "[email protected]/root/openvpn.zip" https://file.io | jq '.link')"
curl -s -X POST https://api.telegram.org/bot"$bot_api"/sendMessage -d chat_id="$tgid" -d text="Бэкап сервера OpenVPN $backup_serv_id Дата: $(date) Ссылка на бэкап: $backupURL"
rm /root/openvpn.zip
}
Answer the question
In order to leave comments, you need to log in
Bind this function to some argument and use case
.
Autobak()
...
case "$1" in
"foo")
Autobak
;;
esac
./script.sh foo
.
1. Decorate this function with a separate bash script, with the name of this function.
2. In the body of the main function of the script, make the option to launch this particular function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question