mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-29 23:38:21 +00:00
update subscription info with cron job
Note: This code only run when when there is subscription key uploaded.
This commit is contained in:
parent
21ace8d328
commit
4027c59b6f
@ -1,15 +1,37 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use PVE::Cluster;
|
|
||||||
use PVE::APLInfo;
|
|
||||||
use PVE::SafeSyslog;
|
|
||||||
use IO::File;
|
use IO::File;
|
||||||
use File::Find;
|
use File::Find;
|
||||||
use File::stat;
|
use File::stat;
|
||||||
|
|
||||||
|
use PVE::Cluster;
|
||||||
|
use PVE::APLInfo;
|
||||||
|
use PVE::SafeSyslog;
|
||||||
|
use PVE::RPCEnvironment;
|
||||||
|
use PVE::API2::Subscription;
|
||||||
|
|
||||||
initlog ('pvedailycron', 'daemon');
|
initlog ('pvedailycron', 'daemon');
|
||||||
|
|
||||||
|
die "please run as root\n" if $> != 0;
|
||||||
|
|
||||||
|
$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
|
||||||
|
|
||||||
|
PVE::INotify::inotify_init();
|
||||||
|
|
||||||
|
my $rpcenv = PVE::RPCEnvironment->init('cli');
|
||||||
|
|
||||||
|
$rpcenv->init_request();
|
||||||
|
$rpcenv->set_language($ENV{LANG});
|
||||||
|
$rpcenv->set_user('root@pam');
|
||||||
|
|
||||||
|
my $nodename = PVE::INotify::nodename();
|
||||||
|
|
||||||
|
eval { PVE::API2::Subscription->update({ node => $nodename }); };
|
||||||
|
if (my $err = $@) {
|
||||||
|
syslog ('err', "update subscription info failed: $err");
|
||||||
|
}
|
||||||
|
|
||||||
my $dccfg = PVE::Cluster::cfs_read_file('datacenter.cfg');
|
my $dccfg = PVE::Cluster::cfs_read_file('datacenter.cfg');
|
||||||
eval { PVE::APLInfo::update($dccfg->{http_proxy}); };
|
eval { PVE::APLInfo::update($dccfg->{http_proxy}); };
|
||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
|
Loading…
Reference in New Issue
Block a user