Szerkesztő:Gyu
A HupWiki-ből...
(Változatok közti eltérés)
(mailq takarítás, ha egyszerre kell feladót és címzettet match-elni) |
(folyt köv.) |
||
| 126. sor: | 126. sor: | ||
u0-2 DISK OK - p2 - 298.013 624977920 | u0-2 DISK OK - p2 - 298.013 624977920 | ||
u0-3 DISK OK - p3 - 298.013 624977920 | u0-3 DISK OK - p3 - 298.013 624977920 | ||
| + | </pre> | ||
| + | |||
| + | =Java Daemon= | ||
| + | |||
| + | <pre> | ||
| + | cat <<'END' >$(which java)dw | ||
| + | #!/bin/bash | ||
| + | |||
| + | exec 2>>$1 >>$1 | ||
| + | shift | ||
| + | exec ${0%/*}/java $* | ||
| + | END | ||
| + | |||
| + | chmod +x $(which java)dw | ||
| + | |||
| + | LOGFILE=PATH_TO_USER_WRITEABLE_LOGFILE | ||
| + | PIDFILE=PATH_TO_USER_WRITEABLE_PIDFILE | ||
| + | DAEMON_ARGS="args to java daemon" | ||
| + | USER=USERNAME_TO_RUN_DAEMON | ||
| + | GROUP=GROUPNAME_TO_RUN_DAEMON | ||
| + | DESC="Service DESCRIPTION" | ||
| + | NAME=SERVICENAME | ||
| + | |||
| + | cp /etc/init.d/skeleton /etc/init.d/$SERVICE | ||
| + | cat <<END | ed /etc/init.d/$SERVICE | ||
| + | /^DESC | ||
| + | d | ||
| + | i | ||
| + | DESC="$DESC" | ||
| + | . | ||
| + | w | ||
| + | END | ||
</pre> | </pre> | ||
A lap 2012. április 19., 10:31-kori változata
Lásd weblapom.
A Firkapapírom:
Tartalomjegyzék |
Egyéb
- syslog-ng.conf részletek:
options {
...
use_dns(persist-only);
dns_cache_hosts(/etc/hosts);
...
};
source smcast { udp(ip(225.0.0.1)); };
source s_udp { udp(); };
destination dp_tty24 { program("/usr/bin/lwatch -i- -o/dev/tty24"); };
destination df_netlog { file("/var/log/net/$HOST/$YEAR-$MONTH.log"); };
filter f_myhosts { netmask(ip.cim.vala.hol/nm); };
log { source(s_all); filter(f_myhosts); destination(df_netlog); };
- mailq takarítás feladó alapján:
mailq | grep -E '^[a-fA-F0-9]+\*?.*johndacosta.*\@yahoo.com.hk' \ | cut -c 1-11 | while read x ; do postsuper -d $x ; done
- mailq takarítás címzett alapján:
mailq | perl -e 'while (<>) { chop ; if ( ($n)= ($_ =~ m/^([0-9A-F]+)\*?\s*/) ) { $qid=$n ; } \
elsif ( defined($qid) and $_ =~ m/^\s+([a-zA-Z0-9+-]+)\@aol.com/ ) { print $qid."\n" ; undef $qid; } \
elsif ( $_ =~ m/^$/ and defined($qid) ) { undef $qid ; } } ' \
| while read qid ; do postsuper -d $qid ; done
- mailq takarítás címzett és feladó egyezés egyszerre megkövetelésekor:
mailq | perl -e 'while (<>) { chop ; if ( ($n,$m)= ($_ =~ m/^([0-9A-F]+)\*?\s* .* (\S+\@\S+)\s*/) ) { $qid=$n ; $from=$m; }
elsif ( defined($qid) and $_ =~ m/^\s+foo\@bar\.hu/ ) { print $qid."\n" if ( $from =~ m/^foo2\@bar2\.hu$/) ; undef $qid; }
elsif ( $_ =~ m/^$/ and defined($qid) ) { undef $qid ; } } ' \
| while read qid ; do postsuper -d $qid ; done
- VIM regexp:
:s/^\(\d\+\)/\=eval(submatch(1)-128)/ :s/\.1\.\(\d\+\)\( \|$\)/\=".2.".eval(submatch(1)-128).submatch(2)/g
SSL
- certifikát megtekintése:
openssl x509 -in file.pem -noout -text
- csr megtekintése:
openssql req -noout -text -in file.csr
- certifikátról leszedni a jelszót (apache, cyrus, postfix, stb. miatt):
openssl rsa -in newreq.pem -out wwwkeyunsecure.pem
SQL
- Unique constraint hozzáadás
CREATE UNIQUE INDEX name ON table (column [, ...]);
- Foreign key hozzáadás
ALTER TABLE table ADD CONSTRAINT constraintname FOREIGN KEY (key) REFERENCES table(column) ;
- NOT NULL constraint hozzáadás
psql:
ALTER TABLE table ALTER COLUMN column SET/DROP NOT NULL ;
Orákel:
ALTER TABLE table MODIFY (column [NOT] NULL) ;
- DEFAULT érték hozzáadás
ALTER TABLE table ALTER COLUMN column SET/DROP DEFAULT expr ;
3Ware
//opal> info c0 u0 status /c0/u0 status = DEGRADED //opal> /c0/p1 show Port Status Unit Size Blocks Serial --------------------------------------------------------------- p1 DEGRADED u0 298.08 GB 625134827 3QF00NLR //opal> /c0/p2 show Port Status Unit Size Blocks Serial --------------------------------------------------------------- p2 OK u0 298.08 GB 625134827 3QF00NP4 //opal> maint remove c0 p1 Exporting port /c0/p1 ... Done. //opal> rescan Rescanning controller /c0 for units and drives ...Done. Found the following unit(s): [none]. Found the following drive(s): [/c0/p1]. //opal> maint rebuild c0 u0 p1 Sending Rebuild-Start request to /c0/u0 on 1 disk(s) [1] ... Done. //opal> info c0 u0 Unit UnitType Status %Cmpl Port Stripe Size(GB) Blocks ----------------------------------------------------------------------- u0 RAID-5 REBUILDING 5 - 64K 894.038 1874933760 u0-0 DISK OK - p0 - 298.013 624977920 u0-1 DISK DEGRADED - p1 - 298.013 624977920 u0-2 DISK OK - p2 - 298.013 624977920 u0-3 DISK OK - p3 - 298.013 624977920
Java Daemon
cat <<'END' >$(which java)dw
#!/bin/bash
exec 2>>$1 >>$1
shift
exec ${0%/*}/java $*
END
chmod +x $(which java)dw
LOGFILE=PATH_TO_USER_WRITEABLE_LOGFILE
PIDFILE=PATH_TO_USER_WRITEABLE_PIDFILE
DAEMON_ARGS="args to java daemon"
USER=USERNAME_TO_RUN_DAEMON
GROUP=GROUPNAME_TO_RUN_DAEMON
DESC="Service DESCRIPTION"
NAME=SERVICENAME
cp /etc/init.d/skeleton /etc/init.d/$SERVICE
cat <<END | ed /etc/init.d/$SERVICE
/^DESC
d
i
DESC="$DESC"
.
w
END
