Server : Apache System : Linux ks5.tuic.fr 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 User : pragmatice ( 1003) PHP Version : 8.2.24 Disable Function : NONE Directory : /home/script/ |
#!/bin/bash # Script to send sms using Free API # Example : monit notifications, backups, alerts... #https://fr33tux.org/post/utiliser-lapi-sms-de-free/ ## VARIABLES CURL=/usr/bin/curl URL=https://smsapi.free-mobile.fr/sendmsg #PASS FREE PASS=7Jwp1fOBeDTwUg #USER FREE USER=44615453 MESSAGE="" TYPE="" # FUNCTIONS help() { echo "=================================== Help :" echo "sh sms.sh SERVER SERVICE_NAME [Parameter]" echo "Send a sms using the following pattern :" echo "" echo "Server SERVER service SERVICE_NAME alert [: Parameter]." echo "" echo "The sms is sent to the phone number corresponding to the USER variable." exit 1 } test_params() { if [ ! $1 = "" ] && [ ! $2 = "" ] then SERVER=$1 SERVICE_NAME=$2 if test -n $3 then TYPE=$3 fi else help exit 1 fi } main() { test_params $1 $2 $3 if [ ! $TYPE = "" ] then MESSAGE="Server : $SERVER Alert $SERVICE_NAME : $TYPE" else MESSAGE="Server $SERVER Alert $SERVICE_NAME" fi $CURL -k -X POST "https://smsapi.free-mobile.fr/sendmsg?user=$USER&pass=$PASS&msg=$MESSAGE" } # MAIN PROG main $* exit 0