pct exec -> Syntax -c " ' "-> how to solve?

PTR

New Member
Feb 20, 2022
10
0
1
40
Code:
pct exec 7000 -- bash -c "echo 'APT::periodic::Update-Package-Lists "1";
      APT::periodic::Download-Upgradeable-Packages "1";
      APT::periodic::AutocleanInterval "7";
      APT::periodic::Unattended-Upgrade "1";' > /etc/apt/apt.conf.d/20auto-upgrades"

answer:
Code:
bash: -c: option requires an argument


-> to many cascaded " is the problem?
How can I solve that syntax problem? \" does not work....


As above but clearly structured:
Code:
pct exec 7000 -- bash -c
 "
   echo '
             APT::periodic::Update-Package-Lists "1";
             APT::periodic::Download-Upgradeable-Packages "1";
             APT::periodic::AutocleanInterval "7";
             APT::periodic::Unattended-Upgrade "1";
            '
   > /etc/apt/apt.conf.d/20auto-upgrades
 "
 
Last edited:
I'm not totally sure what goes wrong here but what works is adding -e for echo and setting newlines manually. This might help you in figuring out whats going wrong :)

Code:
pct exec 7000 -- bash -c "echo -e 'APT::periodic::Update-Package-Lists "1";\nAPT::periodic::Download-Upgradeable-Packages "1";\nAPT::periodic::AutocleanInterval "7";\nAPT::periodic::Unattended-Upgrade "1";\n' > /etc/apt/apt.conf.d/20auto-upgrades"
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!