I want to execute a perl commando using the exec command but I cannot get the syntax correct.
vzctl exec 12345 "/usr/bin/perl \-pi\~ \-e \'\$\_=\"servername=my.hostname.here\\n\" if /\^servername=/\' /usr/local/directadmin/conf/directadmin.conf"
When i execute the above commando i get the following error:
Can't find string terminator "'" anywhere before EOF at -e line 1.
I tried several options and combinations but i cannot get it correct, it keeps giving an error.
The following command works within the VZ container itself:
/usr/bin/perl -pi~ -e '$_="servername=my.hostname.here\n" if /^servername=/' /usr/local/directadmin/conf/directadmin.conf
So this command should be executed from the hardware node (outside the VZ container) using the vzctl exec command.
Can someone see the error here?
Thx for any help.