Antón María Rodríguez Yuste

 
 
 
  • About

    Consultor orientado al sector TELCO (eTOM, SID), dirección de proyectos (scrum) y sistemas (Oracle, Weblogic, Jboss, Solaris, etc.). Un poco de todo, vamos.

  • Varios

Sindicación


Licencia


Validación



Sistemas






Varios

 
wc -l August 13th, 2007

Para contar cuantas veces aparece la palabra Exception en un fichero:

CODE:
  1. grep -i "exception" fichero | wc -l
Secuencias de oracle August 3rd, 2007

Peleando con las secuencias de oracle.

Para aumentar las secuencias en uno:

CODE:
  1. select 'alter sequence '||t.sequence_name||' increment by 1;' from all_sequences t where t.sequence_owner='ASAP';

Para ver el valor actual de la secuencias:

CODE:
  1. select SQ_END_USER_LOCATION.currVal FROM DUAL;

Para ver el siguiente (ojo, modifica la secuencia):

CODE:
  1. select SQ_END_USER_LOCATION.nextVal FROM DUAL;

Todo esto viene de una tabla cuyos campos tenían valores mucho más altos que el nextVal de la secuencia, por lo que tuvimos que aumentar mucho ese valor con la primera query.

Instalando multitail en solaris August 2nd, 2007
CODE:
  1.  
  2. wget ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/multitail-5.2.0-sol10-sparc-local.gz
  3. gunzip multitail-5.2.0-sol10-sparc-local.gz
  4. pkgadd -d multitail-5.2.0-sol10-sparc-local
  5. wget ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/ncurses-5.6-sol10-sparc-local.gz
  6. gunzip ncurses-5.6-sol10-sparc-local.gz
  7. pkgadd -d ncurses-5.6-sol10-sparc-local
  8.  

No es el apt-get pero me vale

Ademas, para tener colores, añadir al .bashrc la siguiente linea:

alias multitail='TERM=xterm-color multitail'

Samba sobre solaris August 2nd, 2007

Aquí va:

Samba
We use the samba from sun (SFW) its configuration files are in /etc/sfw

Samba Setup
First we remove the old startup scripts:

# ls -l /etc/rc?.d/???samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc0.d/K03samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc1.d/K03samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc2.d/K03samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc3.d/S90samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rcS.d/K03samba
# rm /etc/rc?.d/???samba
# mv /etc/init.d/samba /etc/init.d/nonsmf_samba

Then we need a configuration:

# cd /etc/sfw
# cp swamba.conf-exampel samba.conf

Create a control script /opt/local/lib/svc/method/samba which contains

CODE:
  1.  
  2. #!/sbin/sh
  3. #
  4.  
  5. case "$1" in
  6. start)
  7.         /usr/sfw/sbin/smbd -D
  8.         /usr/sfw/sbin/nmbd -D
  9.         ;;
  10. stop)
  11.         pkill smbd
  12.         pkill nmbd
  13.         ;;
  14. *)
  15.         echo "Usage: $0 { start | stop }"
  16.         exit 1
  17.         ;;
  18. esac
  19. exit 0
  20.  

The manifest in /root/samba/samba.xml should contain

CODE:
  1.  
  2. <?xml version='1.0'?>
  3. <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
  4. <service_bundle type='manifest' name='WISWsamba:samba'>
  5.   <service name='site/samba' type='service' version='0'>
  6.     <create_default_instance enabled="false"/>
  7.     <single_instance />
  8.     <!--
  9.         First of all, if the config file is not present,
  10.         then we needn't bother with anything else. 
  11.     -->
  12.     <dependency name="config-file" grouping="require_all" restart_on="none" type="path">
  13.       <service_fmri value="file:///etc/sfw/smb.conf"/>
  14.     </dependency>
  15.     <!--
  16.       If there's no network, then there's no point in running
  17.     -->
  18.     <dependency name='loopback' grouping='require_all' restart_on='error' type='service'>
  19.       <service_fmri value='svc:/network/loopback:default'/>
  20.     </dependency>
  21.     <dependency name='physical' grouping='optional_all' restart_on='error' type='service'>
  22.       <service_fmri value='svc:/network/physical:default'/>
  23.     </dependency>
  24.     <!--
  25.       Since Samba may be providing a home directory service,
  26.       it is as well that we ensure that the file-systems are
  27.       all mounted before it is started. This is not essential
  28.       but in general it is a good thing and doesn't really hurt.
  29.     -->
  30.     <dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
  31.       <service_fmri value='svc:/system/filesystem/local'/>
  32.     </dependency>
  33.  
  34.     <!--
  35.       now we have the start stop and refresh methods
  36.     -->
  37.     <exec_method name='start' type='method' exec='/opt/local/lib/svc/method/samba start' timeout_seconds='60'>
  38.       <method_context />
  39.     </exec_method>
  40.     <exec_method name='stop' type='method' exec='/opt/local/lib/svc/method/samba stop' timeout_seconds='60'>
  41.       <method_context />
  42.     </exec_method>
  43.      
  44.     <property_group name='samba' type='application'>
  45.       <stability value='Evolving'/>
  46.     </property_group>
  47.     <property_group name='startd' type='framework'>
  48.       <propval name='ignore_error' type='astring' value='core,signal'/>
  49.     </property_group>
  50.  
  51.     <stability value='Evolving'/>
  52.     <!--
  53.       A description of the Service
  54.     -->
  55.     <template>
  56.       <common_name>
  57.         <loctext xml:lang='C'>Samba Server</loctext>
  58.       </common_name>
  59.       <documentation>
  60.         <manpage title='samba' section='1M'/>
  61.         <doc_link name='samba.org' uri='http://httpd.samba.org'/>
  62.       </documentation>
  63.     </template>
  64.   </service>
  65. </service_bundle>
  66.  

Import the manifes

# svccfg import /root/samba/samba.xml

Start Samba

# svcadm enable samba

La fuente: sun