perl -pi -e 's/\n/\r\n/g'
Example above is changing linux to windows line endings. This came about during my previous post of using base64 to attach ascii text files.
Simple enough.
Random snippets of unix/linux and sometimes windows.
perl -pi -e 's/\n/\r\n/g'
( echo "to: $recipients"
echo "subject: Report for rsync for from_leads on `date`"
echo "mime-version: 1.0"
echo "content-type: multipart/related; boundary=xBoundaryStringx"
echo
echo "--xBoundaryStringx"
echo "content-type: text/plain"
echo "Body Text"
echo "Body Text"
echo "--xBoundaryStringx"
echo "content-type: text/plain; charset=us-ascii; name=$filename"
echo "content-transfer-encoding: base64"
echo
openssl base64 < $filename ) |sendmail -t -i
# metastat -c
d106 m 22GB d16 d26 (resync-66%)
d16 s 22GB c1t0d0s6
d26 s 22GB c1t1d0s6 (resyncing)
d9 m 52GB d19 (maint) d29 (maint)
d19 s 52GB c1t2d0s6
d29 s 52GB c1t3d0s6
d8 m 16GB d18 (maint) d28 (maint)
d18 s 16GB c1t2d0s1
d28 s 16GB c1t3d0s1
d4 m 10GB d14 d24 (maint)
d14 s 10GB c1t0d0s4
d24 s 10GB c1t1d0s4 (maint)
d0 m 20GB d20 (maint) d10 (maint)
d20 s 20GB c1t1d0s0 (resyncing)
d10 s 20GB c1t0d0s0 (last-erred)
d1 m 16GB d11 d21
d11 s 16GB c1t0d0s1
d21 s 16GB c1t1d0s1
metareplace -e d106 c1t1d0s6
# metareplace -e d4 c1t1d0s4
d4: device c1t1d0s4 is enabled
# metasync d8
# metasync d9
# iostat -E
sd1 Soft Errors: 6 Hard Errors: 1131 Transport Errors: 0
Vendor: FUJITSU Product: MAY2073RCSUN72G Revision: 0401 Serial No: 6643S13H5W
Size: 73.41GB <73407865856 bytes>
Media Error: 969 Device Not Ready: 0 No Device: 162 Recoverable: 6
Illegal Request: 1 Predictive Failure Analysis: 0
# metastat d0
d0: Mirror
Submirror 0: d20
State: Needs maintenance
Submirror 1: d10
State: Needs maintenance
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 41945472 blocks (20 GB)
d20: Submirror of d0
State: Needs maintenance
Invoke: metasync d0
Size: 41945472 blocks (20 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s0 0 No Resyncing Yes
d10: Submirror of d0
State: Needs maintenance
Invoke: after replacing "Maintenance" components:
metareplace d0 c1t0d0s0 <new device>
Size: 41945472 blocks (20 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Last Erred Yes
# prtvtoc /dev/rdsk/c1t0d0s2
* /dev/rdsk/c1t0d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 424 sectors/track
* 24 tracks/cylinder
* 10176 sectors/cylinder
* 14089 cylinders
* 14087 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 0 33560448 33560447
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 33560448 41945472 75505919
1 3 01 0 33560448 33560447
2 5 00 0 143349312 143349311
3 0 00 75505920 91584 75597503
4 7 00 75597504 20972736 96570239
6 0 00 96570240 46687488 143257727
7 0 00 143257728 91584 143349311
analyze> setup
Analyze entire disk[yes]? no
Enter starting block number[0, 0/0/0]: 33560448
Enter ending block number[143349311, 14086/23/423]: 75505919
Loop continuously[no]? no
Enter number of passes[2]:
Repair defective blocks[yes]?
Stop after first error[no]?
Use random bit patterns[no]?
Enter number of blocks per transfer[126]: 1
Verify media after formatting[yes]?
Enable extended messages[no]?
Restore defect list[yes]?
Restore disk label[yes]?
analyze> read
Ready to analyze (won't harm SunOS). This takes a long time,
but is interruptable with CTRL-C. Continue? y
Loading: /platform/SUNW,SPARC-Enterprise-T2000/kernel/sparcv9/unix
Loading: /platform/sun4v/kernel/sparcv9/unix
SunOS Release 5.10 Version Generic_147440-12 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
os-io Cross trap sync timeout: at cpu_sync.xword[1]: 0x1010panic: failed to stop cpu8
panic: failed to stop cpu9
panic: failed to stop cpu10
panic: failed to stop cpu11
panic: failed to stop cpu12
panic: failed to stop cpu13
panic: failed to stop cpu14
panic: failed to stop cpu15
panic[cpu1]/thread=2a100bbfca0: xt_sync: timeout
[Patch]
147440-02 or newer SunOS 5.10: Solaris kernel patch
[Note]
If you apply this patch to a system with firmware version older than
6.4.6, system panic occurs during booting and the following message is
output.
<Example of message>
----------------------------------------------------------------------
panic[cpu14]/thread=2a1027f5ca0: xt_sync: timeout
----------------------------------------------------------------------
<Environment>
This problem occurs on the following models.
- Sun Fire T1000/T2000
- SPARC Enterprise T1000/T2000
<Conditions>
Firmware version is older than 6.4.6. (*1)
*1) To confirm, execute the showhost command on ALOM.
In the following example, firmware version is 6.7.11.
<Example of command execution>
sc> showhost
SPARC-Enterprise-T1000 System Firmware 6.7.11 2010/10/12 12:34
Host flash versions:
OBP 4.30.4.b 2010/07/09 13:43
Hypervisor 1.7.3.c 2010/07/09 15:14
POST 4.30.4.b 2010/07/09 14:25
# ./sysfwdownload Sun_System_Firmware-6_7_12-SPARC_Enterprise_T2000.bin
.......... (10%).......... (20%).......... (30%).......... (41%)..........
(51%).......... (61%).......... (71%).......... (82%).......... (92%)........ (100%)
Download completed successfully
# init 0
sc> poweroff
SC Alert: SC Request to Power Off Host.
SC Alert: Host system has shut down.
sc> setkeyswitch -y normal
sc> flashupdate -s 127.0.0.1
sc> resetsc