If you're using RHEL, then the following commands may help:
su postgres
cd /usr/pgsql-9.2/bin
./pg_ctl -D /var/lib/pgsql/9.2/data reload
Tips and experience about developing websites with various technologies
su postgres
cd /usr/pgsql-9.2/bin
./pg_ctl -D /var/lib/pgsql/9.2/data reload
[root@webserver failed]# iconv -f utf-8 bad_file.xml -o /dev/null
iconv: illegal input sequence at position 25691275
head -c 25691310 bad_file.xml
iconv -f utf8 -t utf8 -c bad_file.xml > fixed.xml
find . -type f -exec bash -c 'iconv -f utf8 -t utf8 -c "{}" > ../fixed/"{}"' \;
# deploy.sh
# Script to shutdown tomcat and redeploy webapp
#Check the number of arguments
if [ "$#" -ne 2 ]
then
echo "Missing arguments: webapp name and WAR file location"
exit 1
fi
if [ -z "$1" ]
then
echo "First argument cannot be empty"
exit 1
fi
if [ -z "$2" ]
then
echo "Second argument cannot be empty"
exit 1
fi
tomcatHome="/usr/local/apache-tomcat-7.0.55"
echo "Tomcat home: $tomcatHome"
# Get the process ID of tomcat
pid=$(ps h -C java -o "%p:%a" | grep catalina | cut -d: -f1)
if [ "$pid" > 0 ]
then
echo "Shutting down tomcat PID $pid"
# Shutdown tomcat
#$tomcatHome/bin/shutdown.sh
kill -9 $pid
# Wait until tomcat is shutdown
while kill -0 $pid > /dev/null; do sleep 1; done
fi
# remove the old webapp
echo "Removing webapp $1"
mv $tomcatHome/webapps/$1.war $tomcatHome
rm -rf $tomcatHome/webapps/$1
# Copy the new WAR file to the webapps folder
cp $2 $tomcatHome/webapps/$1.war
# Change the permissions
chown tomcat:tomcat $tomcatHome/webapps/$1.war
# Start up tomcat
/etc/init.d/tomcat start
# Finished
echo "redeployed successfully"
./deploy.sh TaskRequest /home/philip/TaskRequest.war
chmod a+x deploy.sh
at 21:00
at> /root/deploy.sh TaskRequest /home/philip/TaskRequest.war
CTRL-D
CRTL-D will end the prompt[root@apntest1 webapps]# atq
2 2015-10-28 09:30 a root
[root@apntest1 webapps]# at -c 2
#!/bin/sh
# atrun uid=0 gid=0
# mail philip 0
umask 22
HOSTNAME=apntest1; export HOSTNAME
SHELL=/bin/bash; export SHELL
OLDPWD=/usr/local/apache-tomcat-7.0.55; export OLDPWD
USER=root; export USER
LS_COLORS=no=00:fi=00:di=00\;34:ln=00\;36:pi=40\;33:so=00\;35:bd=40\;33\;01:cd=40\;33\;01:or=01\;05\;37\;41:mi=01\;05\;37\;41:ex=00\;32:\*.cmd=00\;32:\*.exe=00\;32:\*.com=00\;32:\*.btm=00\;32:\*.bat=00\;32:\*.sh=00\;32:\*.csh=00\;32:\*.tar=00\;31:\*.tgz=00\;31:\*.arj=00\;31:\*.taz=00\;31:\*.lzh=00\;31:\*.zip=00\;31:\*.z=00\;31:\*.Z=00\;31:\*.gz=00\;31:\*.bz2=00\;31:\*.bz=00\;31:\*.tz=00\;31:\*.rpm=00\;31:\*.cpio=00\;31:\*.jpg=00\;35:\*.gif=00\;35:\*.bmp=00\;35:\*.xbm=00\;35:\*.xpm=00\;35:\*.png=00\;35:\*.tif=00\;35:; export LS_COLORS
SUDO_USER=philip; export SUDO_USER
SUDO_UID=501; export SUDO_UID
USERNAME=root; export USERNAME
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/philip/bin; export PATH
MAIL=/var/spool/mail/philip; export MAIL
PWD=/usr/local/apache-tomcat-7.0.55/webapps; export PWD
LANG=en_AU; export LANG
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass; export SSH_ASKPASS
SHLVL=1; export SHLVL
SUDO_COMMAND=/bin/su; export SUDO_COMMAND
HOME=/root; export HOME
LOGNAME=root; export LOGNAME
CVS_RSH=ssh; export CVS_RSH
LESSOPEN=\|/usr/bin/lesspipe.sh\ %s; export LESSOPEN
SUDO_GID=501; export SUDO_GID
G_BROKEN_FILENAMES=1; export G_BROKEN_FILENAMES
cd /usr/local/apache\-tomcat\-7\.0\.55/webapps || {
echo 'Execution directory inaccessible' >&2
exit 1
}
${SHELL:-/bin/sh} << `(dd if=/dev/urandom count=200 bs=1 2>/dev/null|LC_ALL=C tr -d -c '[:alnum:]')`
/root/deploy.sh TaskRequest /home/philip/TaskRequest.war
at 21:00
at> /root/deploy.sh TaskRequest /home/philip/TaskRequest.war | mail -s "Webapp deployment" jo.blo@gmail.com
CTRL-D
echo "/root/deploy.sh TaskRequest /home/philip/TaskRequest.war | mail -s \"Task request redeployed\" jo.blow@gmail.com" | at 19:45
yum install postfix
bash: mail: command not found# yum install mailx
relayhost=some.ip.address
echo "please work" | mail -s "Test email" email@gmail.com
echo "please work" | mail -v -s "Test email" email@gmail.com
Mail Delivery Status Report will be mailed to root.
[root@apn-lsrv01 ~]# mail
Heirloom Mail version 12.4 7/29/08. Type ? for help.
"/var/spool/mail/root": 13 messages 2 new 11 unread
10 Mail Delivery System Thu Oct 29 08:09 68/2348 "Mail Delivery Status Report"
11 Mail Delivery System Thu Oct 29 08:13 66/2276 "Mail Delivery Status Report"
>N 12 Mail Delivery System Thu Oct 29 08:28 65/2239 "Mail Delivery Status Report"
N 13 Mail Delivery System Thu Oct 29 08:28 65/2239 "Mail Delivery Status Report"
& 13
Message 13:
From MAILER-DAEMON Thu Oct 29 08:09:19 2015
Return-Path: <>
X-Original-To: root@blah
Delivered-To: root@blah
Date: Thu, 29 Oct 2015 08:09:19 +1100 (AEDT)
From: MAILER-DAEMON@blah (Mail Delivery System)
Subject: Mail Delivery Status Report
To: root@blah
Auto-Submitted: auto-replied
Content-Type: multipart/report; report-type=delivery-status;
boundary="745D91181D8A.1446066559/blah"
Status: R
Part 1:
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii
This is the mail system at host blah.
Enclosed is the mail delivery report that you requested.
The mail system
<someones@email>: delivery temporarily suspended: Host or domain name not
found. Name service error for name=bad.smtp.server type=AAAA: Host not
found
<?php
$slide1_head = check_plain(theme_get_setting('slide1_head','nexus')); $slide1_desc = check_markup(theme_get_setting('slide1_desc','nexus'), 'full_html'); $slide1_url = check_plain(theme_get_setting('slide1_url','nexus'));
$slide2_head = check_plain(theme_get_setting('slide2_head','nexus')); $slide2_desc = check_markup(theme_get_setting('slide2_desc','nexus'), 'full_html'); $slide2_url = check_plain(theme_get_setting('slide2_url','nexus'));
$slide3_head = check_plain(theme_get_setting('slide3_head','nexus')); $slide3_desc = check_markup(theme_get_setting('slide3_desc','nexus'), 'full_html'); $slide3_url = check_plain(theme_get_setting('slide3_url','nexus'));
$slide4_head = check_plain(theme_get_setting('slide4_head','nexus')); $slide4_desc = check_markup(theme_get_setting('slide4_desc','nexus'), 'full_html'); $slide4_url = check_plain(theme_get_setting('slide4_url','nexus'));
?>
<div id="slidebox" class="flexslider">
<ul class="slides">
<li>
<img src="<?php print base_path() . drupal_get_path('theme', 'nexus') . '/images/slide-image-1.jpg'; ?>"/>
<?php if($slide1_head || $slide1_desc) : ?>
<div class="flex-caption">
<h2><?php print $slide1_head; ?></h2><?php print $slide1_desc; ?>
<a class="frmore" href="<?php print url($slide1_url); ?>"> <?php print t('READ MORE'); ?> </a>
</div>
<?php endif; ?>
</li>
<li>
<img src="<?php print base_path() . drupal_get_path('theme', 'nexus') . '/images/slide-image-2.jpg'; ?>"/>
<?php if($slide2_head || $slide2_desc) : ?>
<div class="flex-caption">
<h2><?php print $slide2_head; ?></h2><?php print $slide2_desc; ?>
<a class="frmore" href="<?php print url($slide2_url); ?>"> <?php print t('READ MORE'); ?> </a>
</div>
<?php endif; ?>
</li>
<li>
<img src="<?php print base_path() . drupal_get_path('theme', 'nexus') . '/images/slide-image-3.jpg'; ?>"/>
<?php if($slide3_head || $slide3_desc) : ?>
<div class="flex-caption">
<h2><?php print $slide3_head; ?></h2><?php print $slide3_desc; ?>
<a class="frmore" href="<?php print url($slide3_url); ?>"> <?php print t('READ MORE'); ?> </a>
</div>
<?php endif; ?>
</li>
<li>
<img src="<?php print base_path() . drupal_get_path('theme', 'nexus') . '/images/slide-image-4.jpg'; ?>"/>
<?php if($slide4_head || $slide4_desc) : ?>
<div class="flex-caption">
<h2><?php print $slide4_head; ?></h2><?php print $slide4_desc; ?>
<a class="frmore" href="<?php print url($slide4_url); ?>"> <?php print t('READ MORE'); ?> </a>
</div>
<?php endif; ?>
</li>
$form['nexus_settings']['slideshow']['slide4'] = array(
'#type' => 'fieldset',
'#title' => t('Slide 4'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['nexus_settings']['slideshow']['slide4']['slide4_head'] = array(
'#type' => 'textfield',
'#title' => t('Slide Headline'),
'#default_value' => theme_get_setting('slide4_head','nexus'),
);
$form['nexus_settings']['slideshow']['slide4']['slide4_desc'] = array(
'#type' => 'textarea',
'#title' => t('Slide Description'),
'#default_value' => theme_get_setting('slide4_desc','nexus'),
);
$form['nexus_settings']['slideshow']['slide4']['slide4_url'] = array(
'#type' => 'textfield',
'#title' => t('Slide URL'),
'#default_value' => theme_get_setting('slide4_url','nexus'),
);
plugins {
runtime "my-plugin:my-plugin:1.0-SNAPSHOT"
}
// Apply plugin must come first, the order is very important!
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
group = 'my-plugin'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.10'
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final'
}
package anu.individual
import java.util.Collection;
import java.util.List;
import java.util.Set;
import javax.persistence.ElementCollection
import javax.persistence.Entity
import javax.persistence.EnumType
import javax.persistence.Enumerated
import javax.persistence.GeneratedValue
import javax.persistence.Id
import javax.persistence.JoinColumn
import javax.persistence.JoinTable
import javax.persistence.ManyToOne
import javax.persistence.OneToMany
/**
* Individual domain class, defined using JPA
*
* @author Philip
*
*/
// Using JPA annotations
@Entity
class Individual {
@Id
@GeneratedValue
Long id
String externalId
String externalIdUpperCase // variable not used
Boolean deleted= false
@ManyToOne
@JoinColumn(name="mother_id")
Individual mother
@ManyToOne
@JoinColumn(name="father_id")
Individual father
Long mustererBarcode
@ElementCollection
Set<String> phenotypes // snowmed CT IDs
@Enumerated(EnumType.STRING)
Species species
Boolean affected
Boolean proband
@Enumerated(EnumType.STRING)
Gender gender
@OneToMany
@JoinTable(
name="individual_team",
joinColumns= @JoinColumn(name="individual_id", referencedColumnName="id"),
inverseJoinColumns= @JoinColumn(name="team_id", referencedColumnName="id")
)
Set<Team> teams
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.1.1'
}
}
plugins {
id "io.spring.dependency-management" version "0.5.2.RELEASE"
}
version "0.1"
group "individual"
apply plugin: "spring-boot"
apply plugin: "war"
apply plugin: "asset-pipeline"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}
assets {
minifyJs = true
minifyCss = true
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:scaffolding"
runtime "org.grails.plugins:asset-pipeline"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'
console "org.grails:grails-console"
// custom dependencies
compile 'anu.individual:individual-lib:1.0-SNAPSHOT'
runtime 'postgresql:postgresql:9.1-901.jdbc4'
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
<!DOCTYPE hibernate-configuration SYSTEM
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<mapping package="anu.individual" />
<mapping class="anu.individual.Individual" />
<mapping class="anu.individual.Team" />
</session-factory>
</hibernate-configuration>
"To specify that an annotated class uses a non-default datasource, create a hibernate.cfg.xml file for that datasource with the file name prefixed with the datasource name."
For example, if I have a datasource named ds1, then i would change the name of the hibernate config file to ds1_hibernate.cfg.xml