Subversion Repositories ALCASAR

Rev

Rev 1606 | Rev 2250 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1606 Rev 1670
Line 33... Line 33...
33
config="/etc/gammu_smsd_conf"
33
config="/etc/gammu_smsd_conf"
34
logfile="/var/log/gammu-smsd/gammu-smsd.log"
34
logfile="/var/log/gammu-smsd/gammu-smsd.log"
35
script="/usr/local/bin/alcasar-sms.sh"
35
script="/usr/local/bin/alcasar-sms.sh"
36
public_page="/var/www/html/autoregistrationinfo.php"
36
public_page="/var/www/html/autoregistrationinfo.php"
37
index_page="/var/www/html/index.php"
37
index_page="/var/www/html/index.php"
-
 
38
intercept_page="/var/www/html/intercept.php"
38
separator="########## START ##########"
39
separator="########## START ##########"
39
end="%%%%%%%%%% STOP %%%%%%%%%%"
40
end="%%%%%%%%%% STOP %%%%%%%%%%"
40
 
41
 
41
 
42
 
42
usage="Usage: alcasar-gammu.sh 
43
usage="Usage: alcasar-gammu.sh 
Line 249... Line 250...
249
 
250
 
250
					# On converti les deux dates en secondes, pour les comparer.
251
					# On converti les deux dates en secondes, pour les comparer.
251
						d_exp=$(date --date "$date_expiration" +%s)
252
						d_exp=$(date --date "$date_expiration" +%s)
252
						d_scr=$(date --date "$date_script" +%s)
253
						d_scr=$(date --date "$date_script" +%s)
253
 
254
 
254
 
-
 
255
						if test $d_scr -gt $d_exp		# Si le ban à expiré
255
						if test $d_scr -ge $d_exp		# Si le ban à expiré
256
						then
256
						then
257
 
257
 
258
							# Test sur le nombre de mots (resultat)
258
							# Test sur le nombre de mots (resultat)
259
							if [ $nb -eq 2 ]	# Si 2 mots : le mot de passe est manquant
259
							if [ $nb -eq 2 ]	# Si 2 mots : le mot de passe est manquant
260
							then
260
							then
Line 334... Line 334...
334
		echo "$usage"
334
		echo "$usage"
335
		exit 0
335
		exit 0
336
		;;
336
		;;
337
	--start)
337
	--start)
338
		gammu_pid=`/usr/sbin/pidof gammu-smsd|wc -l`
338
		gammu_pid=`/usr/sbin/pidof gammu-smsd|wc -l`
339
        if [ $gammu_pid != "0" ]
339
		if [ $gammu_pid != "0" ]
340
            then
340
			then
341
                echo "gammu is already started"
341
			echo "gammu is already started"
342
            else
342
		else
343
                start_gammu
343
			start_gammu
344
                sed -i "s/\$service_SMS_status=\"false\";/\$service_SMS_status=\"true\";/g" $index_page
344
			sed -i "s/\$service_SMS_status=\"false\";/\$service_SMS_status=\"true\";/g" $index_page
345
                sed -i "s/\$service_SMS_status=false;/\$service_SMS_status=true;/g" $public_page
345
			sed -i "s/\$service_SMS_status=false;/\$service_SMS_status=true;/g" $public_page
-
 
346
			sed -i "s/\$service_SMS_status=false;/\$service_SMS_status=true;/g" $intercept_page
346
        fi
347
		fi
347
        exit 0
348
		exit 0
348
        ;;
349
		;;
349
    --stop)
350
	--stop)
350
        gammu_pid=`/usr/sbin/pidof gammu-smsd|wc -l`
351
		gammu_pid=`/usr/sbin/pidof gammu-smsd|wc -l`
351
        if [ $gammu_pid != "0" ]
352
		if [ $gammu_pid != "0" ]
352
            then
353
			then
353
                stop_gammu
354
			stop_gammu
354
                sed -i "s/\$service_SMS_status=\"true\";/\$service_SMS_status=\"false\";/g" $index_page
355
			sed -i "s/\$service_SMS_status=\"true\";/\$service_SMS_status=\"false\";/g" $index_page
355
                sed -i "s/\$service_SMS_status=true;/\$service_SMS_status=false;/g" $public_page
356
			sed -i "s/\$service_SMS_status=true;/\$service_SMS_status=false;/g" $public_page
-
 
357
			sed -i "s/\$service_SMS_status=true;/\$service_SMS_status=false;/g" $intercept_page
356
            else
358
		else
357
                echo "gammu is already stopped"
359
			echo "gammu is already stopped"
358
            fi
360
		fi
359
        exit 0
361
		exit 0 
360
        ;;
362
		;;
361
	--pidof)
363
	--pidof)
362
		/sbin/pidof gammu-smsd
364
		/sbin/pidof gammu-smsd
363
		;;
365
		;;
364
	--last_nosim)
366
	--last_nosim)
365
		# Récupère la dernière ligne où NOSIM est présent (error)
367
		# Récupère la dernière ligne où NOSIM est présent (error)