With the following command, all stderr and stdout are redirected to /tmp/ss.log and run in the background.
python sslocal -c /etc/shadowsocks.json > /tmp/ss.log 2>&1 &
Now to redirect stderr and stdout to the / var / log directory as follows.
python sslocal -c /etc/shadowsocks.json > /var/log/ss.log 2>&1 & bash: /var/log/ss.log: Permission denied
He is facing a resolution problem.
I tried sudo tee as shown below.
python sslocal -c /etc/shadowsocks.json |sudo tee -a /var/log/ss.log 2>&1 & python sslocal -c /etc/shadowsocks.json 2>&1|sudo tee -a /var/log/ss.log & nohup python sslocal -c /etc/shadowsocks.json |sudo tee -a /var/log/ss.log 2>&1 & nohup python sslocal -c /etc/shadowsocks.json 2>&1|sudo tee -a /var/log/ss.log &
They all face a different problem, the team cannot work in the background, it starts as a foreground process.
How to redirect stderr and stdout to / var / log directory in the background?
source share