I'm trying to write my first ever shell script, the OS is Raspbian. The code I have written must be executed whenever a certain database has been modified. The database resides on a Windows server to which I have a mount point, and I have no control over the Windows server at all so changing directory names is not an option unfortunately. Here is the script I have written to date:
Unfortunately, no matter what, the script ALWAYS equates to false. I have included the 'ls' commands in the script purely for debugging purposes so I can check the variable declaration is working correctly and also to verify dates on the files. So when I run the script, this is the output I receive:
So clearly the declaration for DB1 is working, as the ls command in the script succeeds, and the output also clearly shows that DB1 is indeed the newer of the 2 files, but for some reason the file age test fails. If I change the script to perform the test based on files that do NOT contain spaces in the path then it works as expected, so there is no error in the logic of the code, but clearly the spaces in the pathname are causing a problem.
I've been working on this for a few days now, and I've researched as much as I can but have hit a brick wall. Any help would be very much appreciated.
Thank you!
*** UPDATE ***
I re-wrote the script to point to files on the local server only, taking the CIFS share out of the equation, and IT WORKS! So it would appear that the problem is caused by the fact the database resides on a CIFS share, but why on earth would that be the case when the ls output clearly shows the file is accessible? Here is the mount information just incase it helps to shed some light on the problem:
I need help with a perl parsing script. I have some error logs on a windows machine that I need to parse from a text file, but I know nothing about perl. I usually run this bash script on my linux box and it does just what I need. How would I do the same thing with perl and port it to my windows... (2 Replies)
Hello there,
As a newbie:
The directories in PATH can be hard to distinguish when printed out as
one line with colon .Please, can i have a sample script to display
them,one to a line.
Thank you. (1 Reply)
Hey, I'm new here. Basically, I'm trying to make a bash script that affects a file of my choice.
What I want to do is $./script.sh /path/to/file.jpg and then the bash script will know that variable=/path/to/file.jpg
Thanks! (4 Replies)
Hi all!
Looking for some help parsing filenames in bash. I have a directory full of files named "livingroom-110111105637.avi". The format is always date and time (yymmddhhmmss). I'm looking to parse the filenames so they are a little more easily readable. Maybe rename them to... (4 Replies)
Hi ,
I have a config _file that has 3 columns (Id Name Value ) with many rows . In my bash script i want to be able to parse the file and do a mapping of any Id value
so if i have Id of say brand1 then i can use the name (server5X) and Value (CCCC) and so on ...
Id Name ... (2 Replies)
Hi
I'm just messing around with bash and trying to learn it because I have a course next semester dealing with OS design where we need to know how to use SSH client and either bash or ksh. I've never done shell scripting before.
I just started today and I was wondering how parsing files... (1 Reply)
I would like to setup a script that pulls in time/date in two seperate columns, and then name the other columns as listed below:
Column1=Art/TJ output
Column2=Art/TJ output
Column3=TJ output
column4=Art output
Column5=If time/date past 12:00 noon -fail
Colume6=If time/date before... (1 Reply)
I have this code to extract the directory name ($0:h) in tcsh. I am converting the code to bash and need a way to get the equivalent setting for DefRaytracPath
set DefRaytracPath = `echo $0:h | awk 'BEGIN {FS="/tcsh"} {print $1"/prog"}'` (3 Replies)
Hello All,
I have the following input file that i'm trying to parse:
10.0.011.40
hadoop 15526 15524 0
hadoop 15528 15526 0
hadoop 19747 4018 1
10.0.081.227
hadoop 2862 2861 0
hadoop 2864 2862 0
hadoop 12177 14376 1
I'm trying to get this in my output file:
10.0.011.40 15526 15528... (2 Replies)
I am trying to automate editing of a json file using bash script.
The file I initially receive is
{
"appMap": {
"URL1": {
"name": "a"
},
"URL2": {
"name": "b"
},
"URL3": {
"name": "c"
},
}
WHat I would like to do is replace... (5 Replies)
Discussion started by: Junaid Subhani
5 Replies
LEARN ABOUT CENTOS
upgradedb
UPGRADEDB(8) System Manager's Manual UPGRADEDB(8)NAME
upgradedb - Directory Server script for upgrading the database
SYNOPSIS
upgradedb [-a archivedir] [-Z serverID] [-f] [-v] [-d debuglevel] [-h]
DESCRIPTION
Checks the DB version and if it has the old index formatting then it will rebuild the indexes. This is usually needed after migrating from
older versions of Directory Server. This script must be run while the server is stopped.
OPTIONS
A summary of options is included below:
-n Backend Name
The name of the LDBM database to reindex. Example: userRoot
-a Database directory
The full path to the database directory.
-Z Server Identifier
The server ID of the Directory Server instance. If there is only one instance on the system, this option can be skipped.
-N Only checks whether any DNs in the database need to be updated.
-h
Display the usage.
EXAMPLE
upgradedb -Z instance2
DIAGNOSTICS
Exit status is zero if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error.
AUTHOR
upgradedb was written by the 389 Project.
REPORTING BUGS
Report bugs to http://bugzilla.redhat.com.
COPYRIGHT
Copyright (C) 2013 Red Hat, Inc.
Mar 5, 2013 UPGRADEDB(8)