Tag Archives: linux

Send email from Linux command line

Every once a while you need to send email from a Linux command line and there you go to google try to find it…

With attachment:

echo "message" | mailx -s "subject" -a attachment email@dress
echo "message" | mutt -s "subject" -a attachment -- email@dress

Without attachment:

echo "message" | mail -s "subject" email@ddress

Important:
Postfix by default restrict attachment size to approx 10MB i.e. 10240000 bytes.

You can check it using following command:

postconf | grep message_size_limit

To change attachment-size to say 50 MB, run a command like:

postconf -e message_size_limit=52428800

Dell PowerEdge 1750 kernel panic on CentOS 6.x workaround

If you have an old Dell PowerEdge 1750 and want to install CentOS 6.x on it so that you can do something useful with it you will bump into kernel panic once you install it. So after some googling I’ve found this workaround to solve the kernel panic problem.
[cc lang=”bash” width=”100%”]
dmesg
[/cc]
If somewhere on that list of line you find the folowing:
[cc width=”100%”]
scb2_flash: warning – can’t reserve rom window, continuing
resource map sanity check conflict: 0xfff00000 0xffffffff 0xfff80000 0xffffffff reserved
————[ cut here ]————
WARNING: at arch/x86/mm/ioremap.c:98 __ioremap_caller+0x435/0x450() (Not tainted)
Hardware name: PowerEdge 1750
Info: mapping multiple BARs. Your kernel is fine.
Modules linked in: scb2_flash(+) ext4 jbd2 mbcache sd_mod crc_t10dif sr_mod cdrom megaraid_mbox megaraid_mm ata_generic pata_acpi pata_serverworks dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]
Pid: 452, comm: modprobe Not tainted 2.6.32-431.5.1.el6.i686 #1
Call Trace:
[] ? warn_slowpath_common+0x81/0xc0
[] ? __ioremap_caller+0x435/0x450
[] ? __ioremap_caller+0x435/0x450
[] ? warn_slowpath_fmt+0x33/0x40
[] ? __ioremap_caller+0x435/0x450
[] ? scb2_flash_probe+0x99/0x2a0 [scb2_flash]
[] ? ioremap_nocache+0x18/0x20
[] ? scb2_flash_probe+0x99/0x2a0 [scb2_flash]
[] ? scb2_flash_probe+0x99/0x2a0 [scb2_flash]
[] ? local_pci_probe+0xb/0x10
[] ? pci_device_probe+0x61/0x80
[] ? driver_probe_device+0x87/0x290
[] ? pci_match_device+0x12/0xa0
[] ? __driver_attach+0x79/0x80
[] ? __driver_attach+0x0/0x80
[] ? bus_for_each_dev+0x52/0x80
[] ? driver_attach+0x16/0x20
[] ? __driver_attach+0x0/0x80
[] ? bus_add_driver+0x1b7/0x2b0
[] ? pci_device_remove+0x0/0x40
[] ? driver_register+0x5f/0x110
[] ? tracepoint_module_notify+0x1f/0x30
[] ? scb2_flash_init+0x0/0x14 [scb2_flash]
[] ? __pci_register_driver+0x3d/0xb0
[] ? do_one_initcall+0x2f/0x1c0
[] ? sys_init_module+0xb4/0x220
[] ? do_page_fault+0x2a/0x90
[] ? syscall_call+0x7/0xb
—[ end trace 9fd84e2ca1f666fb ]—
[/cc]
Edit /etc/modprobe.d/blacklist.conf file
[cc lang=”bash” width=”100%”]
vim /etc/modprobe.d/blacklist.conf
[/cc]
and add:
[cc lang=”bash” width=”100%”]
# Cheesy workaround to clean up Dell PowerEdge 1750 boot
# scb2_flash is not happy and causes a kernel oops and traceback
# Not sure of the consequences of not having this and its associated modules loaded, but the machine boots cleanly
# http://www.mailrepository.com/ubuntu-bugs.lists.ubuntu.com/msg/3409389/
blacklist scb2_flash
[/cc]

Install Java SE Development Kit 7u40 on CentOS 6.4

Installing JDK on CentOS can be hard, so to help you I’ve made this simple tutorial. Hope it helps…

Download and install:

Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html an select JDK Download.

Install JDK:
[cc lang=”bash” width=”100%”]
rpm -ivh /path-to-file/jdk-7u40-linux-i586.rpm
[/cc]
And set it up:
[cc lang=”bash” width=”100%”]
alternatives –install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
alternatives –install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000
[/cc]

Check if it is installed correctly:

[cc lang=”bash” width=”100%”]
java -version
[/cc]
Should return something like:
[cc lang=”bash” width=”100%”]
java version “1.7.0_40″
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Server VM (build 24.0-b56, mixed mode)
[/cc]
And
[cc lang=”bash” width=”100%”]
javac -version
[/cc]
Should return something like:
[cc lang=”bash” width=”100%”]
javac 1.7.0_40
[/cc]

OPTIONAL

Set JAVA_HOME variable:

[cc lang=”bash” width=”100%”]
echo “export JAVA_HOME=\”/usr/java/latest\”” > /etc/profile.d/java.sh
[/cc]

Install Firefox browser support:

32-bit plugin:
[cc lang=”bash” width=”100%”]
alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 20000
[/cc]
64-bit plugin:
[cc lang=”bash” width=”100%”]
alternatives –install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 20000
[/cc]

References:

  1. Install Oracle Java JDK/JRE 7u25 on Fedora 19/18, CentOS/RHEL 6.4/5.9