0

I am using a script on RHEL server where I'm copying a backup of the /etc/syslog.conf file before making configurable changes in it. I used the below command in the script:

 cp -pr /etc/syslog.conf /etc/syslog.conf.bkp.`date +"%d%m%Y"`

The script ran absolutely fine on one RHEL server, but on the other it shows the below error:

cp: cannot stat `/etc/syslog.conf': No such file or directory

I also checked the /etc/syslog/conf file exists in the server just fine.

Why is the difference of behaviour. How to resolve it ?

dig_123
  • 2,240
  • 6
  • 35
  • 59

1 Answers1

1

cp: cannot stat is mainly because cp command can't see the file. It can be for two reasons.

  • File is not present
  • You don't have permission to view the file.

If you check these two things you should be able to find the answer

Shantanu
  • 2,206
  • 18
  • 16