Alternc  latest
Alternc logiel libre pour l'hébergement
cron_ssl.sh
Go to the documentation of this file.
1 #!/usr/bin/php
2 <?php
3 /**
4  * script called as a every-minute-crontab
5  * to look for new certificates and reload the associated subdomains
6  * also delete the old certificates once a day (at 10am)
7  */
8 
9 // Bootstrap
10 require_once("/usr/share/alternc/panel/class/config_nochk.php");
11 
12 if (!isset($ssl)) {
13  echo "OUPS: update_cert.sh launched, but ssl module not installed, exiting\n";
14  exit();
15 }
16 
17 if (posix_getuid()!=0) {
18  echo "This script MUST be launched as root, it should be able to overwrite files in /etc/ssl/private\n";
19  exit(-1);
20 }
21 
22 if (date("H:m")=="10:00") {
23  $ssl->delete_old_certificates();
24 }
25 
26 $ssl->cron_new_certs();
27 
28