mschaedler1982
Goto Top

Linux Abfrage

Hallo zusammen

Ich versuche über einen Cronjob von allen Compute Nodes den beanspruchten Festplatten Platz herauszufinden.

for i in $(seq -w 1 20);do echo n0$i;ssh n0$i 'df -h|grep /dev/sda2|awk '$5 > 1 { print $5}'\;' ;done > /tmp/test2.txt ; mail -s "Festplatten Auslastung" user@domain < /tmp/test2.txt  

Als Test habe ich mal die "1" als Wert angegeben der Code 'df -h|grep /dev/sda2|awk '$5 > 1 { print $5}' funktioniert an sich und liefert mir auch den korrekten Wert.

Als Rückmeldung erhalte ich diese Fehlermeldung:

awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:1: {
awk: cmd. line:1: ^ unexpected newline or end of string

Andere Crontab Jobs wie s.u laufen.

for i in $(seq -w 1 20);do echo n0$i;ssh n0$i 'cd /data2/ABAQUS_SCRATCH && find . -type d -ctime +30 -exec rm -rf {} \;' ;done  

Ich komme hier leider nicht weiter, hat mir hierzu jemand einen Tipp?

Content-Key: 308312

Url: https://administrator.de/contentid/308312

Ausgedruckt am: 29.03.2024 um 01:03 Uhr

Mitglied: Sheogorath
Sheogorath 27.06.2016 um 11:41:57 Uhr
Goto Top
Moin,

was auch immer du probierst, schau dir einfach mal das tool `df` an. Mit `df -h` bekommst du eine saubere ausgabe mit GB ;)

Gruß
Chris
Mitglied: 129813
Lösung 129813 27.06.2016 um 11:47:01 Uhr
Goto Top
Hi.
You are using single quotes inside a single quoted string face-wink, this doesn't work. So use double quoted outside if you want to use single one's inside.
Regards
Mitglied: mschaedler1982
mschaedler1982 27.06.2016 um 12:04:50 Uhr
Goto Top
Hi highload.

thank you for the comment. Without the quotes outside it works.

Regards
Mitglied: Cthluhu
Cthluhu 27.06.2016 um 12:05:36 Uhr
Goto Top
Hi,

Du hast verschachtelte Anführungszeichen im ersten Beispiel (beim awk). Beim zwiten nicht. Darum geht das erste Beispiel nicht und das zweite schon.

mfg

Cthluhu