I have a newly created Informix database instance.
I have following DB spaces.
**
RootDBS, temptbs, logdbs, physdbs
**
I have four chunks. I need to assign them to above DB spaces initially. What is the way to do that? Is there any related documentation about this? Please mention the documentation.
You can use the onspaces command to add further chunks to an existing dbspace or to create new dbspaces. Documentation for this can be found in the Knowledge Center at https://www.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.admin.doc/ids_admin_0561.htm - for example in the sections "Adding a chunk to a dbspace or blobspace" and "Creating a dbspace that uses the default page size."
This is the documentation for Informix version 12.10 but the command syntax is the same in earlier releases.
The initial chunk of the root dbspace, rootdbs, is specified in the $ONCONFIG file (which is located in $INFORMIXDIR/etc; see onconfig file for documentation on the format) before you initialize the server with oninit.
ROOTNAME rootdbs
ROOTPATH /opt/informix/dev/osiris_19.rootdbs.c0
ROOTOFFSET 0
ROOTSIZE 1500000
The other dbspaces have to be created separately with onspaces after you've brought the basic server online.
Usage:
onspaces { -a <spacename> -p <path> -o <offset> -s <size> [-m <path> <offset>]
{ { [-Mo <mdoffset>] [-Ms <mdsize>] } | -U }
} |
{ -c { -d <DBspace> [-k <pagesize>] [-t]
-p <path> -o <offset> -s <size> [-m <path> <offset>] } |
{ -d <DBspace> [-k <pagesize>]
-p <path> -o <offset> -s <size> [-m <path> <offset>]
[-ef <first_extent_size>] [-en <next_extent_size>] } |
{ -P <PLOGspace>
-p <path> -o <offset> -s <size> [-m <path> <offset>] } |
{ -b <BLOBspace> -g <pagesize>
-p <path> -o <offset> -s <size> [-m <path> <offset>] } |
{ -S <SBLOBspace> [-t]
-p <path> -o <offset> -s <size> [-m <path> <offset>]
[-Mo <mdoffset>] [-Ms <mdsize>] [-Df <default-list>] } |
{ -x <Extspace> -l <Location> } } |
{ -d <spacename> [-p <path> -o <offset>] [-f] [-y] } |
{ -f[y] off [<DBspace-list>] | on [<DBspace-list>] } |
{ -m <spacename> {-p <path> -o <offset> -m <path> <offset> [-y] |
-f <filename>} } |
{ -r <spacename> [-y] } |
{ -s <spacename> -p <path> -o <offset> {-O | -D} [-y] } |
{ -ch <sbspacename> -Df <default-list> } |
{ -cl <sbspacename> } |
{ -ren <spacename> -n <newname> }
-a - Add a chunk to a DBspace, BLOBspace or SBLOBspace
-c - Create a DBspace, PLOGspace, BLOBspace, SBLOBspace, or Extspace
-d - Drop an empty DBspace, PLOGspace, BLOBspace, SBLOBspace, Extspace,
or chunk
-f - Change dataskip default for specified DBspaces
-m - Add mirroring to an existing DBspace, PLOGspace, BLOBspace or
SBLOBspace
-r - Turn mirroring off for a DBspace, PLOGspace, BLOBspace or SBLOBspace
-s - Change the status of a chunk
-ch - Change default list for smart large object space
-cl - garbage collect smart large objects that are not referenced
default-list = {[LOGGING = {ON|OFF}] [,ACCESSTIME = {ON|OFF}]
[,AVG_LO_SIZE = {1 - 2097152}] }
-ren - Rename a DBspace, BLOBspace, SBLOBspace or Extspace
The logdbs and physdbs dbspaces are presumably for the logical logs and the physical log. Those would be created as normal dbspaces, and then you'd move the logs to those spaces with onparams:
Usage: onparams { -a -d <DBspace> [-s <size>] [-i] } |
{ -b -g <pagesize> [-n <number of buffers>]
[-r <number of LRUs>] [-x <maxdirty>] [-m <mindirty>] } |
{ -d -l <log file number> [-y] } |
{ -p -s <size> [-d <DBspace>] [-y] }
-a - Add a logical log file
-b - Add a buffer pool
-i - Insert after current log
-d - Drop a logical log file
-p - Change physical log size and location
-y - Automatically responds "yes" to all prompts
The temptbs is presumably a temporary dbspace, which you'll end up listing in your $ONCONFIG file too (as DBSPACETEMP)
You might end up with (dumb) blob spaces and smart blob spaces too, and you'll probably end up with a temporary sbspace (smart blob space) specified in $ONCONFIG too (as SBSPACETEMP).
You can use the onmode utility to set (some but not all) configuration parameters while the server is running with the -wf option, for example. You could set entries such as SBSPACETEMP like that.
Related
I am trying to execute a program (say, biotool) using GNU-parallel which takes 3 arguments, i, o and a :
the input files (i)
output file name to be written in (o)
an argument which takes a sub string from the input file name (a)
for example, say i have 10 text files like this
1_a_test.txt
2_b_test.txt
3_c_test.txt
...
10_j_test.txt
I want to run my tool (say biotool) on all the 10 text files. I tried this
parallel biotool -i {} -o {.}.out -a {} ::: *.txt
I want to pass the charachter/letter/whatever before the first underscore from the input text file name as an argument to -a option like this (dry run):
parallel biotool -i 1_a_test.txt -o 1_a_test.out -a 1 ::: *.txt`
parallel biotool -i 2_b_test.txt -o 2_b_test.out -a 2 ::: *.txt`
parallel biotool -i 3_c_test.txt -o 3_c_test.out -a 3 ::: *.txt`
...
{} supplies the complete file name to -a but I only want the sub string before the first underscore to be supplied to -a
The easiest, but harder to read is this:
parallel --dry-run biotool -i {} -o {.}.out -a '{= s/_.*// =}' ::: *test.txt
Alternatively, you can make a bash function that uses bash Parameter Substitution to extract the part before the underscore. Then export that to make it known to GNU Parallel
#!/bin/bash
doit(){
i=$1
o=$2
# Use internal bash parameter substitution to extract whatever precedes "_"
# See https://www.tldp.org/LDP/abs/html/parameter-substitution.html
a=${i/_*/}
echo biotool -i "$i" -o "$o" -a "$a"
}
export -f doit
parallel doit {} {.}.out ::: *test.txt
Sample Output
biotool -i 10_j_test.txt -o 10_j_test.out -a 10
biotool -i 1_a_test.txt -o 1_a_test.out -a 1
biotool -i 2_b_test.txt -o 2_b_test.out -a 2
I have this script shell and i want to create task gulp to execute it.
for tag in `git tag -l | sort -V |head -n -4`
do
echo $tag
if [ -n "$(echo $tag | grep -P "(^v.*-*)")" ] then
echo VERSION=$(echo $tag | grep -P "(^v.*-*)")
git tag -d $(echo $tag | grep -P "(^v.*-*)")
git push origin :$tag
fi
done
I'm using those plugins in my gulpfile :
var gulp = require('gulp'),
shell = require('gulp-shell'),
pckg = require('./package.json'),
runSequence = require('run-sequence'),
is there any solution?
I use grep -L to get a list of files that do not contain a certain string. How can I see the content of those files? Just like:
grep -L "pattern" | cat
You can use xargs:
grep -L "pattern" | xargs cat
As read in man xargs --> build and execute command lines from standard input. So it will cat to those file names that grep -L returns.
You can use cat and use the output of grep -L...
cat $(grep -L "pattern" *.files )
I want to grep -R a directory but exclude symlinks how dow I do it?
Maybe something like grep -R --no-symlinks or something?
Thank you.
Gnu grep v2.11-8 and on if invoked with -r excludes symlinks not specified on the command line and includes them when invoked with -R.
If you already know the name(s) of the symlinks you want to exclude:
grep -r --exclude-dir=LINK1 --exclude-dir=LINK2 PATTERN .
If the name(s) of the symlinks vary, maybe exclude symlinks with a find command first, and then grep the files that this outputs:
find . -type f -a -exec grep -H PATTERN '{}' \;
The '-H' to grep adds the filename to the output (which is the default if grep is searching recursively, but is not here, where grep is being handed individual file names.)
I commonly want to modify grep to exclude source control directories. That is most efficiently done by the initial find command:
find . -name .git -prune -o -type f -a -exec grep -H PATTERN '{}' \;
For now.. here is how I would exclude symbolic links when using grep
If you want just file names matching your search:
for f in $(grep -Rl 'search' *); do if [ ! -h "$f" ]; then echo "$f"; fi; done;
Explaination:
grep -R # recursive
grep -l # file names only
if [ ! -h "file" ] # bash if not a symbolic link
If you want the matched content output, how about a double grep:
srch="whatever"; for f in $(grep -Rl "$srch" *); do if [ ! -h "$f" ]; then
echo -e "\n## $f";
grep -n "$srch" "$f";
fi; done;
Explaination:
echo -e # enable interpretation of backslash escapes
grep -n # adds line numbers to output
.. It's not perfect of course. But it could get the job done!
If you're using an older grep that does not have the -r behavior described in Aryeh Leib Taurog's answer, you can use a combination of find, xargs and grep:
find . -type f | xargs grep "text-to-search-for"
If you are using BSD grep (Mac) the following works similar to '-r' option of Gnu grep.
grep -OR <PATTERN> <PATH> 2> /dev/null
From man page
-O If -R is specified, follow symbolic links only if they were explicitly listed on the command line.
I'm looking to automatically tweet notification center messages from my mac. Is there a way to use Growl or Applescript to achieve this? Thanks!
I've been able to use the following method to script tweets.
This Applescript code is used to compose the tweet manually with a enter text dialogue and run the shell script which checks and send the tweet. It does not use text from Growl or Notification Centre.
Applescript code:
set q to display dialog "Tweet:" default answer ""
set myTweet to text returned of q
if (length of myTweet) > 140 then
display dialog "I'm pretty sure that tweet is too long (" & (length of t as text) & " chars)" buttons {"oh"} default button 1
else
set e to do shell script "cd /pathTo/folderContaining/;./tweet.sh <yourtwitterhandle> <yourtwitterpassword> \"" & myTweet & "\""
if e ≠ "" then display dialog e buttons {"OK"} default button 1
end if
I've had some problems with the character limit, so I usually make my tweets extra short. Maybe you can find a 'length of' limit shorter than 140 (see AS code: if (length of myTweet) > 140 then) that will work consistently.
Here is the shell script; modified from http://360percents.com/posts/command-line-twitter-status-update-for-linux-and-mac/ ,
Make sure you name it 'tweet.sh' and make it executable using chmod or Kilometre.app (notice I've commented out all the reporting so it runs completely quietly):
#!/bin/bash
#REQUIRED PARAMS (crg - now passed through command line)
username=$1
password=$2
tweet=$3 #must be less than 140 chars
#EXTRA OPTIONS
uagent="Mozilla/5.0" #user agent (fake a browser)
sleeptime=0 #add pause between requests
if [ $(echo "$tweet" | wc -c) -gt 140 ]; then
echo "[FAIL] Tweet must not be longer than 140 chars!" && exit 1
elif [ "$tweet" == "" ]; then
echo "[FAIL] Nothing to tweet. Enter your text as argument." && exit 1
fi
touch "cookie.txt" #create a temp. cookie file
#crg - commented out all 'success' echos ... will only return string if error
#GRAB LOGIN TOKENS
#echo "[+] Fetching twitter.com..." && sleep $sleeptime
initpage=$(curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" "https://mobile.twitter.com/session/new")
token=$(echo "$initpage" | grep "authenticity_token" | sed -e 's/.*value="//' | sed -e 's/" \/>.*//')
#LOGIN
#echo "[+] Submitting the login form..." && sleep $sleeptime
loginpage=$(curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" -d "authenticity_token=$token&username=$username&password=$password" "https://mobile.twitter.com/session")
#GRAB COMPOSE TWEET TOKENS
#echo "[+] Getting compose tweet page..." && sleep $sleeptime
composepage=$(curl -s -b "cookie.txt" -c "cookie.txt" -L -A "$uagent" "https://mobile.twitter.com/compose/tweet")
#TWEET
#echo "[+] Posting a new tweet: $tweet..." && sleep $sleeptime
tweettoken=$(echo "$composepage" | grep "authenticity_token" | sed -e 's/.*value="//' | sed -e 's/" \/>.*//' | tail -n 1)
update=$(curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" -d "authenticity_token=$tweettoken&tweet[text]=$tweet&tweet[display_coordinates]=false" "https://mobile.twitter.com/")
#GRAB LOGOUT TOKENS
logoutpage=$(curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" "https://mobile.twitter.com/account")
#LOGOUT
#echo "[+] Logging out..." && sleep $sleeptime
logouttoken=$(echo "$logoutpage" | grep "authenticity_token" | sed -e 's/.*value="//' | sed -e 's/" \/>.*//' | tail -n 1)
logout=$(curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" -d "authenticity_token=$logouttoken" "https://mobile.twitter.com/session/destroy")
rm "cookie.txt"