Slackware - InstallationThis forum is for the discussion of installation issues with Slackware.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My suggestion to run a cron job, was based on assuming you would know how to respond to interactive request, like responding to .new files.
If you run a cron job, aren't you removing the ability to respond to the interactive requests? You'd have to run something else to notify you of any .new files and then handle them manually.
Been working through all the suggestion and am working out "issues". I've removed all the duplicate packages that slackpkg upgrade wanted me to remove or blacklist. Tip: don't name files .orig! I've customarily done this with as-installed files like e.g. /etc/profile, etc/httpd/httpd.conf, and the like before customizing. I found that when a package is uninstalled slackpkg renames the .orig file to be the actual config file! I had quite a bit of restoring to do with php.ini, httpd.conf, httpd-ssl.conf, etc.
Now I have an issue with one of the upgrades not working right -- the point of this posting: is there a way to see the upgrade history? To nail down my issue I need to know when I installed the latest update of this package. The date of the installed files is whenever the package was release, not when it was installed and I cannot seem to find something like `slackpkg history <package>` in either the docs or on the web.
Been working through all the suggestion and am working out "issues". I've removed all the duplicate packages that slackpkg upgrade wanted me to remove or blacklist. Tip: don't name files .orig! I've customarily done this with as-installed files like e.g. /etc/profile, etc/httpd/httpd.conf, and the like before customizing. I found that when a package is uninstalled slackpkg renames the .orig file to be the actual config file! I had quite a bit of restoring to do with php.ini, httpd.conf, httpd-ssl.conf, etc.
Since Didier already answered your other question, I figured I'd just throw in my little anecdote for this.
As an alternative to using .orig, you should be able to switch to .bak (or .back if you prefer). I've been using the .bak method for probably 15 years if not more and never ran into any problems with it (except for when I have .bak, .bak1, .bak-new, etc, and I end up confusing myself on which one I actually want).
Since Didier already answered your other question, I figured I'd just throw in my little anecdote for this.
As an alternative to using .orig, you should be able to switch to .bak (or .back if you prefer). I've been using the .bak method for probably 15 years if not more and never ran into any problems with it (except for when I have .bak, .bak1, .bak-new, etc, and I end up confusing myself on which one I actually want).
I never use .orig or .bak suffices when making backup copies of files or directories, since that is are too generic and error-prone, see the examples in this thread.
When I make a backup copy of a configuration file, I append the suffix .YYYYmmdd, so today's backup of php.ini would become "php.ini.20150820".
I never use .orig or .bak suffices when making backup copies of files or directories, since that is are too generic and error-prone, see the examples in this thread.
When I make a backup copy of a configuration file, I append the suffix .YYYYmmdd, so today's backup of php.ini would become "php.ini.20150820".
That's a great idea and would definitely fix the problem of running out of .bak extensions, although, I'll still probably keep .bak in there so it is easier for me to find and purge old backups of things that are no longer needed.
I never use .orig or .bak suffices when making backup copies of files or directories, since that is are too generic and error-prone, see the examples in this thread.
When I make a backup copy of a configuration file, I append the suffix .YYYYmmdd, so today's backup of php.ini would become "php.ini.20150820".
Quote:
Originally Posted by bassmadrigal
That's a great idea and would definitely fix the problem of running out of .bak extensions, although, I'll still probably keep .bak in there so it is easier for me to find and purge old backups of things that are no longer needed.
Below is a script I use to make TimeStamped BackUps of files and directories.
Save the File someplace in your PATH( I named my copy $HOME/bin/bupfile ) then ...
Code:
chmod 755 $HOME/bin/bupfile
BEWARE: bupfile does not do FileNames with Spaces in them. But who creates FileNames with spaces ? (<G> Fixable, but I don't need it <G>)
Code:
#!/bin/sh
PrgNam="`basename $0`"
DirNam="`dirname $0`"
if [ "$DirNam" = "." ]
then
if [ -f "$PrgNam" ]
then
DirNam="`pwd`"
else
DirNam="`whichone $PrgNam`"
DirNam="`dirname $DirNam`"
fi
elif [ "$DirNam" = ".." ]
then
DirNam="`pwd`"
DirNam="`dirname $DirNam`"
elif [ "`dirname $DirNam`" = ".." ]
then
FooNam="`basename $DirNam`"
DirNam="`pwd -P`"
DirNam="`dirname $DirNam`/$FooNam"
elif [ "$DirNam" = "" ] # should not happen ...
then # see: man 3 dirname
DirNam="`whichone $PrgNam`"
DirNam="`dirname $DirNam`"
fi
AllArg="$@"
DoSec=0
DoRep=1
MySep='~'
MyTag=''
DoTag=0
Verbose=1
Debug=0
NumErr=0
MaxErr=1
MyDStr="`date '+%Y%m%d'`"
MyTStr="`date '+%Y%m%d-%H%M%S'`"
export MySep MyTag DoRep
GetExt ()
{
gawk '
BEGIN {
InpStr = "'"$@"'" ""
OutStr = ""
for ( i = length( InpStr ) ; i > 1 ; i -- ) # dot-files !
{
if (( C = substr( InpStr, i, 1 )) == "." )
{
if ( substr( InpStr, i-1, 1 ) != "/" )
{
OutStr = substr( InpStr, i )
}
break
}
if ( C == "/" )
break
}
print OutStr
exit( 0 )
}'
return
}
WacExt ()
{
myDot="$1" ; shift
gawk '
BEGIN {
myDot = "'"$myDot"'" ""
InpStr = "'"$@"'" ""
OutStr = InpStr
for ( i = length( InpStr ) ; i > 1 ; i -- ) # detect dot-files !
{
if (( C = substr( InpStr, i, 1 )) == myDot )
{
if ( substr( InpStr, i-1, 1 ) != "/" ) # detect dot-files !
{
OutStr = substr( InpStr, 1, i-1 )
}
break
}
if ( C == "/" )
break
}
print OutStr
exit( 0 )
}'
return
}
Error ()
{
if [ $# -lt 1 ]
then
RetCode=1
echo "unspecified error" >&2
else
RetCode=$? ; shift
echo "$@" >&2
fi
exit $RetCode
}
MkNewFile ()
{
[ $# -lt 1 ] && echo "" && return 4
myFile="$1"
[ "$myFile" = "" ] && echo "" && return 5
[ "$MyTag" = "" ] && echo "" && return 6
[ "$DoRep" = "0" ] && echo "${myFile}${MyTag}" && return 0
myWacd="$(WacExt "$MySep" "$myFile")"
echo "${myWacd}${MyTag}"
return 0
}
Usage ()
{
ErrNum=$1
shift
[ $# -gt 0 ] && echo -e "\n$*" >&2
echo -e "\nusage: $PrgNam [ options ] File [ File [ File ... ]]" >&2
cat <<Usage_EOF >&2
Program $PrgNam Backs Up ( copies ) one-or-more Files or Directories
with a DateStamp Suffix: '${MySep}YYYYMMDD'.
Optionally, if the -s Arg is invoked, $PrgNam will append
a DateTimeStamp Suffix: '${MySep}YYYYMMDD-HHMMSS'
Finally, the -t TagORide Arg allows the user to override the default
DateStamp ( or DateTimeStamp ) Suffix with their own Suffix.
Options include:
-e MaxErr - Maximum Number of Errors to allow before ABORT
Default: 1 error
-c SepChr - user-defined Separator Char for the TimeStamp.
Default SepChr = '$MySep'
-s - use DateTimeStamp. Format = '${MySep}YYYYMMDD-HHMMSS'
-a - do not replace old TimeStamp, append a new one instead.
See Note 3. Do be careful with this ! FileNames may
become arbitrarily long !!!
Default: REPLACE $PrgNam TimeStamp with New One.
Note: On Files with multiple TimeStamps, only the
LAST TimeStamp will be replaced.
-t TagORide - use TagORide instead of the default DateStamp
Note: TagORide is literally appended to the
original FileName. Supply your own punctuation !
Note: the -t TagORide option activates the -a Arg
-q operate silently except for errors
Default: echo commands to stderr
Program $PrgNam preserves permissions and Time Stamps on the file
( as file ownership permissions allow ).
Simple Examples:
$PrgNam file # copies file to file${MySep}${MyDStr}
$PrgNam -s file # copies file to file${MySep}${MyTStr}
$PrgNam -t '.kjh' file # copies file to file.kjh
Note1: Program $PrgNam does not operate on SymLinks or Named Pipes !
Note2: When multiple Files / Directories are processed, all will be
Tagged with the same TimeStamp no matter how long it takes to
complete the file copy operations.
Note3: If a file or directory already includes a $PrgNam TimeStamp,
by default the original TimeStamp is REPLACED with the new
TimeStamp.
OTOH, when the -a Arg is invoked, $PrgNam APPENDS the new
TimeStamp to any existing TimeStamps.
Example: to replace any existing TimeStamps with new ones:
$PrgNam file~19990429 # copy file~19990429 to file${MySep}${MyDStr}
Example: to append new TimeStamps to any existing ones:
$PrgNam -a file~19990429 # copy file~19990429 to file~19990429${MySep}${MyDStr}
Example: if the -t TagORide Arg is invoked, $PrgNam APPENDS:
$PrgNam -t .bak file.bak # copy file.bak to file.bak.bak
Note 4: This help text is printed to stderr. To print a hard-copy or to
pipe it thru a pager:
Example: to pass to the less command:
$PrgNam -h 2>&1 |less
Example: to print to 'MyFavoritePrinter'
$PrgNam -h 2>&1 |lp -dMyFavoritePrinter
Error Codes:
Error 1 - No Files were submitted on Command Line
Error 2 - MaxErr Arg was non-numeric or zero
Error 3 - -t TagORide Arg was empty
Error 4 - Programmer Error - MkNewFile was invoked without a FileName
Error 5 - Internal function MkNewFile was passed an empty FileName
Error 6 - Internal function MkNewFile was passed an empty Tag
Error 7 - Internal function MkNewFile returned a NULL FileName
Error 8 - Internal function MkNewFile returned the same FileName
Error 9 - NumErr reached MaxErr
-- kjh 1999-04-29
Usage_EOF
exit $ErrNum
}
while getopts daqshc:t:e: junk 2>/dev/null
do
case $junk in
e) MaxErr="$OPTARG"
;;
c) MySep="$OPTARG"
;;
t) MyTag="$OPTARG"
DoTag=1
DoRep=0
;;
s) DoSec=1
;;
q) Verbose=0
;;
a) DoRep=0
;;
d) Debug=1
Verbose=1
;;
h) Usage 0
;;
*) Usage 1
;;
esac
done
shift `expr $OPTIND - 1`
RetCode=0
FooNum=$(expr $MaxErr + 0 2>/dev/null)
[ $# -lt 1 ] && Error 1 "$PrgNam needs one-or-more Files to back up"
[ $FooNum -lt 1 ] && Error 2 "MaxErr must be numeric"
if [ "$DoTag" = "1" ]
then
[ "$MyTag" = "" ] && Error 3 "-t TagORide is Empty"
elif [ $DoSec -ne 0 ]
then
MyTag="${MySep}${MyTStr}"
else
MyTag="${MySep}${MyDStr}"
fi
[ "$Debug" = "1" ] && Verbose=1
NumErr=0
for File in $@
do
[ "$File" = "" ] && continue # not an Error
[ ! -e "$File" ] && echo "$File does not exist" >&2 && continue # not an Error
[ -L "$File" ] && echo "$PrgNam cannot do SymLinks" >&2 && continue # not an Error
[ -p "$File" ] && echo "$PrgNam does not do Named Pipes" >&2 && continue # not an Error
NewFile="$(MkNewFile $File)"
RetCode=$?
[ "$RetCode" != "0" ] && Error $RetCode "Something went south ... NewFile = '$NewFile' ; RetCode = $RetCode"
[ "$NewFile" = "" ] && Error 7 "Something went south ... '$NewFile' == ''"
[ "$NewFile" = "$File" ] && Error 8 "Something went south ... '$NewFile' == '$File'"
if [ -d "$File" ]
then
Cmd="cp -pR $File $NewFile"
else
Cmd="cp -p $File $NewFile"
fi
[ "$Verbose" != "0" ] && ( echo "$Cmd" ; )
if [ "$Debug" != "1" ]
then
$Cmd
RetCode=$?
fi
[ $RetCode -ne 0 ] && NumErr=$(expr $NumErr + 1)
[ $NumErr -ge $MaxErr ] && RetCode=9 break
done
exit $RetCode
And this is the 'mini man-page' ( type: bupfile -h )
Code:
usage: bupfile [ options ] File [ File [ File ... ]]
Program bupfile Backs Up ( copies ) one-or-more Files or Directories
with a DateStamp Suffix: '~YYYYMMDD'.
Optionally, if the -s Arg is invoked, bupfile will append
a DateTimeStamp Suffix: '~YYYYMMDD-HHMMSS'
Finally, the -t TagORide Arg allows the user to override the default
DateStamp ( or DateTimeStamp ) Suffix with their own Suffix.
Options include:
-e MaxErr - Maximum Number of Errors to allow before ABORT
Default: 1 error
-c SepChr - user-defined Separator Char for the TimeStamp.
Default SepChr = '~'
-s - use DateTimeStamp. Format = '~YYYYMMDD-HHMMSS'
-a - do not replace old TimeStamp, append a new one instead.
See Note 3. Do be careful with this ! FileNames may
become arbitrarily long !!!
Default: REPLACE bupfile TimeStamp with New One.
Note: On Files with multiple TimeStamps, only the
LAST TimeStamp will be replaced.
-t TagORide - use TagORide instead of the default DateStamp
Note: TagORide is literally appended to the
original FileName. Supply your own punctuation !
Note: the -t TagORide option activates the -a Arg
-q operate silently except for errors
Default: echo commands to stderr
Program bupfile preserves permissions and Time Stamps on the file
( as file ownership permissions allow ).
Simple Examples:
bupfile file # copies file to file~20150823
bupfile -s file # copies file to file~20150823-065247
bupfile -t '.kjh' file # copies file to file.kjh
Note1: Program bupfile does not operate on SymLinks or Named Pipes !
Note2: When multiple Files / Directories are processed, all will be
Tagged with the same TimeStamp no matter how long it takes to
complete the file copy operations.
Note3: If a file or directory already includes a bupfile TimeStamp,
by default the original TimeStamp is REPLACED with the new
TimeStamp.
OTOH, when the -a Arg is invoked, bupfile APPENDS the new
TimeStamp to any existing TimeStamps.
Example: to replace any existing TimeStamps with new ones:
bupfile file~19990429 # copy file~19990429 to file~20150823
Example: to append new TimeStamps to any existing ones:
bupfile -a file~19990429 # copy file~19990429 to file~19990429~20150823
Example: if the -t TagORide Arg is invoked, bupfile APPENDS:
bupfile -t .bak file.bak # copy file.bak to file.bak.bak
Note 4: This help text is printed to stderr. To print a hard-copy or to
pipe it thru a pager:
Example: to pass to the less command:
bupfile -h 2>&1 |less
Example: to print to 'MyFavoritePrinter'
bupfile -h 2>&1 |lp -dMyFavoritePrinter
Error Codes:
Error 1 - No Files were submitted on Command Line
Error 2 - MaxErr Arg was non-numeric or zero
Error 3 - -t TagORide Arg was empty
Error 4 - Programmer Error - MkNewFile was invoked without a FileName
Error 5 - Internal function MkNewFile was passed an empty FileName
Error 6 - Internal function MkNewFile was passed an empty Tag
Error 7 - Internal function MkNewFile returned a NULL FileName
Error 8 - Internal function MkNewFile returned the same FileName
Error 9 - NumErr reached MaxErr
-- kjh 1999-04-29
One more note: the tilda chars in the script and the help-text look a lot like dash chars ...
Cut-n-Paste worked as expected from firefox into vim but be careful.
The MySep='~' at line 33 in the script is a tilda, not a dash !
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.