[SOLVED] OTRS CentOS Backup: Can't locate cp!

Moderator: crythias

Locked
rcsdownload
Znuny newbie
Posts: 23
Joined: 29 May 2015, 10:59
Znuny Version: 4.0.7
Real Name: RCS

[SOLVED] OTRS CentOS Backup: Can't locate cp!

Post by rcsdownload »

I'm trying to create a back up on /opt/backup/ directory I've created.
But error shows me ERROR: Can't locate cp!

[root@xxxxxxx scripts]# ./backup.pl --help
backup.pl - backup script
Copyright (C) 2001-2015 xxx, http://otrs.com/
usage: backup.pl -d /data_backup_dir/ [-c gzip|bzip2] [-r 30] [-t fullbackup|nofullbackup|dbonly]
[root@d15e7522c9dc scripts]# ./backup.pl -d /backup/
ERROR: No such directory: /backup/
[root@xxxxxxx scripts]# ./backup.pl -d /opt/backup/
Debug: Config.pm ->Get('DatabaseHost') --> 127.0.0.1
Debug: Config.pm ->Get('Database') --> otrs
Debug: Config.pm ->Get('DatabaseUser') --> otrs
Debug: Config.pm ->Get('DatabasePw') --> otrs
Debug: Config.pm ->Get('DatabaseDSN') --> DBI:mysql:database=otrs;host=127.0.0.1;
Debug: Config.pm ->Get('ArticleDir') --> /opt/otrs//var/article
[Tue Jun 23 14:33:01 2015] backup.pl: Can't exec "which": No such file or directory at ./backup.pl line 125.
[Tue Jun 23 14:33:01 2015] backup.pl: readline() on closed filehandle $In at ./backup.pl line 126.
ERROR: Can't locate cp!

Anyone can help me on this?
Thank you.
Last edited by rcsdownload on 26 Jun 2015, 11:39, edited 4 times in total.
EXG133
Znuny expert
Posts: 217
Joined: 06 Aug 2012, 18:12
Znuny Version: 3.1.7 & 4.04

Re: OTRS CentOS Backup: Can't locate cp!

Post by EXG133 »

This is generating your error:

Code: Select all

# check needed programs
for my $CMD ( 'cp', 'tar', $DBDump, $CompressCMD ) {
    my $Installed = 0;
    open my $In, '-|', "which $CMD";    ## no critic
    while (<$In>) {
        $Installed = 1;
    }
    close $In;
    if ( !$Installed ) {
        print STDERR "ERROR: Can't locate $CMD!\n";
        exit 1;
    }
}

Whats the feedback if you manually type:

which cp

In your shell?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS CentOS Backup: Can't locate cp!

Post by crythias »

You actually have a linux distribution that does not have "which" as a command? Interesting. Alternatively, the path for "which" is not in the path of the current user.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
rcsdownload
Znuny newbie
Posts: 23
Joined: 29 May 2015, 10:59
Znuny Version: 4.0.7
Real Name: RCS

Re: OTRS CentOS Backup: Can't locate cp!

Post by rcsdownload »

I'm running this using a Docker.

When I ssh on my docker container that contains OTRS, it says
#which cp
-bash: which: command not found

When I ssh on the VM where my docker resides
# which cp
alias cp='cp -i'
/bin/cp
rcsdownload
Znuny newbie
Posts: 23
Joined: 29 May 2015, 10:59
Znuny Version: 4.0.7
Real Name: RCS

Re: OTRS CentOS Backup: Can't locate cp!

Post by rcsdownload »

Solved it by installing which command:


# yum whatprovides *.bin.which
^CTraceback (most recent call last):
File "/usr/bin/yum", line 4, in <module>
import yum
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 44, in <module>
import logging.config
File "/usr/lib64/python2.6/logging/config.py", line 30, in <module>
import sys, logging, logging.handlers, string, socket, struct, os, traceback, types
File "/usr/lib64/python2.6/logging/handlers.py", line 27, in <module>
import errno, logging, socket, types, os, string, cPickle, struct, time, re
File "/usr/lib64/python2.6/socket.py", line 50, in <module>
import _ssl
KeyboardInterrupt


# yum whatprovides */bin/which
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/metalink | 2.7 kB 00:00
* base: mirror............
* epel: free..........
* extras: mirror...........
* updates: mirror.........
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.9 MB 00:00
epel/filelists_db | 9.5 MB 00:11
updates/filelists_db | 2.5 MB 00:00
which-2.19-6.el6.x86_64 : Displays where a particular program in your path is located
Repo : base
Matched from:
Filename : /usr/bin/which



nodejs-which-1.0.5-8.el6.noarch : A JavaScript implementation of the 'which' command
Repo : epel
Matched from:
Filename : /usr/lib/node_modules/which/bin/which



# yum install which
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror............
* epel: free..............
* extras: mirror...................
* updates: mirror...................
Resolving Dependencies
--> Running transaction check
---> Package which.x86_64 0:2.19-6.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================
Installing:
which x86_64 2.19-6.el6 base 38 k

Transaction Summary
=====================================================================================================================================================================================================
Install 1 Package(s)

Total download size: 38 k
Installed size: 71 k
Is this ok [y/N]: y
Downloading Packages:
which-2.19-6.el6.x86_64.rpm | 38 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : which-2.19-6.el6.x86_64 1/1
install-info: No such file or directory for /usr/share/info/which.info.gz
Verifying : which-2.19-6.el6.x86_64 1/1

Installed:
which.x86_64 0:2.19-6.el6

Complete!

# /opt/otrs/scripts/backup.pl -d /opt/backup/
Debug: Config.pm ->Get('DatabaseHost') --> 127.0.0.1
Debug: Config.pm ->Get('Database') --> otrs
Debug: Config.pm ->Get('DatabaseUser') --> otrs
Debug: Config.pm ->Get('DatabasePw') --> otrs
Debug: Config.pm ->Get('DatabaseDSN') --> DBI:mysql:database=otrs;host=127.0.0.1;
Debug: Config.pm ->Get('ArticleDir') --> /opt/otrs//var/article
Debug: Config.pm ->Get('Home') --> /opt/otrs/
Debug: Config.pm ->Get('TimeZone') --> <undef>
Backup /opt/backup//2015-06-26_09-35/Config.tar.gz ... done
Backup /opt/backup//2015-06-26_09-35/Application.tar.gz ... done
Dump MySQL rdbms ... done
Compress SQL-file... done
rcsdownload
Znuny newbie
Posts: 23
Joined: 29 May 2015, 10:59
Znuny Version: 4.0.7
Real Name: RCS

Re: OTRS CentOS Backup: Can't locate cp!

Post by rcsdownload »

By the way,
Does this means the backup is already being run daily?
If not how to enable a daily backup?

Thank you.
Locked