]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/tools/lxc_unfreeze.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
12 #include <lxc/lxccontainer.h>
14 #include "arguments.h"
18 lxc_log_define(lxc_unfreeze
, lxc
);
20 static const struct option my_longopts
[] = {
24 static struct lxc_arguments my_args
= {
25 .progname
= "lxc-unfreeze",
29 lxc-unfreeze unfreezes a container with the identifier NAME\n\
32 -n, --name=NAME NAME of the container\n\
33 --rcfile=FILE Load configuration file FILE\n",
34 .options
= my_longopts
,
37 .log_priority
= "ERROR",
41 int main(int argc
, char *argv
[])
43 struct lxc_container
*c
;
46 if (lxc_arguments_parse(&my_args
, argc
, argv
))
49 log
.name
= my_args
.name
;
50 log
.file
= my_args
.log_file
;
51 log
.level
= my_args
.log_priority
;
52 log
.prefix
= my_args
.progname
;
53 log
.quiet
= my_args
.quiet
;
54 log
.lxcpath
= my_args
.lxcpath
[0];
56 if (lxc_log_init(&log
))
59 c
= lxc_container_new(my_args
.name
, my_args
.lxcpath
[0]);
61 ERROR("No such container: %s:%s", my_args
.lxcpath
[0], my_args
.name
);
65 if (!c
->may_control(c
)) {
66 ERROR("Insufficent privileges to control %s:%s", my_args
.lxcpath
[0], my_args
.name
);
74 if (!c
->load_config(c
, my_args
.rcfile
)) {
75 ERROR("Failed to load rcfile");
80 c
->configfile
= strdup(my_args
.rcfile
);
82 ERROR("Out of memory setting new config filename");
88 if (!c
->unfreeze(c
)) {
89 ERROR("Failed to unfreeze %s:%s", my_args
.lxcpath
[0], my_args
.name
);