Header Shadow Image


DD-WRT Remote rsyslog logging

Enable rsyslog listening on server:

# cat /etc/rsyslog.d/remote.conf
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

# Create a log file for each host
$template FILENAME,"/var/log/rsyslog/%fromhost%.log"
*.* ?FILENAME
#

Restart rsyslogd:

service rsyslogd restart

Under the DD-WRT Services -> Services menu enable the following:

System Log
Syslogd          : Enabled
Remote Server: 192.168.0.14

(It assumes port 514, default syslogd port)

Cheers,
TK

 

 

The authentication server returned an unexpected error

When you see this:

The authentication server returned an unexpected error: ns0:RequestFailed: IDM threw unexpected error during authentication :: Native platform error [code: 9234][null][null]. The error may be caused by a malfunctioning identity source.

it can also mean a bad user/password combination:

domain\user01
pass

instead of something like this:

rightdomain\user01
pass

Cheers,
TK

find: paths must precede expression

What if we get this:

# find ./ -iname *package*
find: paths must precede expression: package.tar.gz
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
#

Then use single quotes or double quotes instead:

# find ./ -iname '*package*'

Cheers,
TK

keytool error: java.lang.Exception: Certificate not imported, alias already exists

What if this is seen:

# keytool -importcert -keystore /path/to/my.keystore -storepass CorrectPass -trustcacerts -file ca.crt -noprompt -alias MyAlias
keytool error: java.lang.Exception: Certificate not imported, alias <MyAlias> already exists
#

Then you may do this to remove the CERT if you plan to redo it.

# keytool -delete -keystore /path/to/my.keystore -storepass CorrectPass -alias rhq-ca
#

Followed by this to see it gone:

# keytool –list -keystore /path/to/my.keystore -storepass CorrectPass

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 0 entries

#

Cheers,
TK

keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect

What if you get this:

# keytool –list -keystore /path/to/trust.keystore
Enter keystore password:
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
#

Then you may add this to resolve it:

-storepass CorrectPass

Cheers,
TK

keytool error: java.lang.Exception: Keystore file does not exist: /root/.keystore

What if this is seen:

# keytool -list
keytool error: java.lang.Exception: Keystore file does not exist: /root/.keystore
#

Then this can be done to resolve it, specify the actual keystore location to use:

keytool –list -keystore /path/to/some/trust.keystore

Cheers,
TK

RDP Disconnect

Part of our earlier two posts on Remote Desktop Connection: SSH Tunnel through Putty and DD-WRT for RDP / RDC and Enabling RDP on Windows 7 Home Premium Edition where we setup our RDP connections, we came across an issue of automatic disconnects in our RDP sessions.  Tricky to debug, here are the steps we took to solve this problem.

Read the rest of this entry »

grep in windows with findstr

Life in Linux would be far more difficult without grep. So what’s the equivalent in Windows?

C:\Users\tom>netstat -na|findstr 3389
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
TCP [::]:3389 [::]:0 LISTENING

C:\Users\tom>

Very neat! But now how to alias this guy. Well, we can do this but it doesn’t quite work in pipes:

C:\Users\tom>doskey grep=c:\windows\system32\findstr.exe $*

C:\Users\tom>doskey /macros
grep=c:\windows\system32\findstr.exe $*

C:\Users\tom>grep
FINDSTR: Bad command line

C:\Users\tom>

Have fun with that.

Cheers,
Tom

Simple Home Backup Solution

Earlier we've setup our HTPC and Backup and shared it out to our Windows machines, but one thing we did not add in is the backup job.  With the earlier solutions, the backup becomes trivial.  (Anything can become simple as long as the core design is well designed with future simplicity in mind.)  This is fairly simple by most system administrator standards but does assume you do know a bit of scripting to do the job with.  Naturally this can be done even easier so I'll show two options.  First the KSH option for automating this slightly:

 

#!/usr/bin/ksh

MOI=$(basename $0);

CDATE=$(date);

print — "$MOI: ($CDATE): Starting run of $MOI. " >> /var/log/$MOI.log 2>&1;

# TM="YES";
TM="NO";
TARGET="/mnt/HTPCBackupXFS";

for KEY in $( print \
                /mnt/FLASHLexarMedia-32GB-1             \
                /mnt/FLASHLexarMedia-32GB-0             \
                /mnt/FLASHKingstonCenton                \
                /mnt/VGEnt                              \
                /mnt/HTPCFileStorage                    \
        ); do
        [[ $TM == "NO" ]] && {
                print — "$MOI: Running rsync -avc –progress $KEY $TARGET:";
                rsync -avc –progress $KEY $TARGET;
        } || {
                print — "$MOI: Will run rsync -avc –progress $KEY $TARGET .";
        }
done >> /var/log/$MOI.log 2>&1;

Next we will edit the crontab to add in the job (Type crontab -e on the command line to edit the crontab file):

[root@mbpc-pc mnt]# crontab -l
30 0 * * * nice -n 19 /mnt/htpc.ksh
[root@mbpc-pc mnt]#

This will backup the other drives that I'm sharing to the RAID6 storage we've created.  Next we will take the key bits from there to create separate cron jobs in case scripting or KSH is not your thing.  This is just as good and may be quicker as it'll be ran in parallel (again type crontab -e to get in and edit the crontab file):

30 0 * * * nice -n 19 rsync -avc –progress /mnt/FLASHLexarMedia-32GB-1 /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/FLASHLexarMedia-32GB-0 /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/FLASHKingstonCenton /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/VGEnt /mnt/HTPCBackupXFS;
30 0 * * * nice -n 19 rsync -avc –progress /mnt/HTPCFileStorage /mnt/HTPCBackupXFS;

Naturally, both methods work just as well and you may benefit from some parallelism here doing it the above way.  However, as more sources are managed, this may become more difficult to manage and more editing will be needed.  The above job schedules the backups to start 30 minutes past midnight, 0 and runs every day, *, every month, * each year, *, respectively from left to right.

Cheers,
TK

Schedule job on linux using at

[root@mbpc-pc mnt]# at now htpc.ksh
syntax error. Last token seen: h
Garbled time
[root@mbpc-pc mnt]# at now
at> /mnt/htpc.ksh
at>
job 12 at 2014-10-12 14:04
[root@mbpc-pc mnt]#
[root@mbpc-pc mnt]# ps -ef|grep -i htpc.ksh
root 26031 26030 0 14:04 ? 00:00:00 /usr/bin/ksh /mnt/htpc.ksh
root 26042 24646 0 14:04 pts/2 00:00:00 grep -i htpc.ksh
[root@mbpc-pc mnt]#

For reoccurring see cron.

Cheers,
TK


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License