Code to insert user into Tomcat config file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Code to insert user into Tomcat config file
# 8  
Old 05-05-2011
Code:
sed -i '$ i\<user username="'$user'" password="'$pword'" roles="'$roles'" />' input.txt

When $(last line) is used, </tomcat-users> is assumed to appear at the end of the file. and i that follows inserts the text right before </tomcat-users>(last line).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Setting config database user and password using sed

Hello everybody, I need to modify 200 files using a patern matching, I would like to do it with sed but it's not working with the following syntax: sed -e 's/DATABASE_PASSWORD.*oldpass/DATABASE_PASSWORD__', 'newpass/g' config.php need to find: define("__DATABASE_PASSWORD__", ... (6 Replies)
Discussion started by: dco
6 Replies

2. Shell Programming and Scripting

Insert a user input string after matched string in file

i am having file like this #!/bin/bash read -p 'Username: ' uservar match='<color="red" />' text='this is only a test so please be patient <color="red" />' echo "$text" | sed "s/$match/&$uservar\g" so desireble output what i want is if user type MARIA this is only a test so please... (13 Replies)
Discussion started by: tomislav91
13 Replies

3. UNIX for Beginners Questions & Answers

Possible to insert a few lines of code into a file at a specific point?

Hi Folks - How would I go about inserting a chunk of lines (3) into a specific portion of a file? The background is I have a script (non shell) that it executed daily, however on Sundays, I uncomment a section of code so that piece can be run as well. So I was hoping to write a piece of... (9 Replies)
Discussion started by: SIMMS7400
9 Replies

4. Solaris

Tomcat..Unable to deploy application remotely in tomcat

Hi, We have upgrade tomcat from 5.0.20 to 7.0.33 and made changes to server.xml file according to newer version.. how ever the upgrade went fine and now i am unable to deploy application remotely.. it is giving 403 access denied error.. we have seperate appbase directory mentioned in server.xml..... (0 Replies)
Discussion started by: phani4u
0 Replies

5. UNIX for Advanced & Expert Users

postfix config: how to relay mails for only one user of a certain domain

Hello there, First of all I tell you that this is my first postfix installation so please be patient... I have following scenario: fetchmail --> postfix --> amavis-new --> postfix --> exchange 2010. Everything -except exchange ;-)- runs on an opensuse 12.1 box. Now, I have a list of... (0 Replies)
Discussion started by: lpacor
0 Replies

6. SuSE

How to config root kde same as user?

Eclipse looks completely different when run under root compared to my user. It's like kde wasn't setup for root upon installation. I'm running Suse 9.3 Pro. How do I configure root kde so that eclipse looks the same when run as user? (3 Replies)
Discussion started by: shwick2
3 Replies

7. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

8. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

9. Solaris

Tomcat Error-HTTP Status code 500

when I typed path http://localhost:8080/MyFirst/HelloWorld in web-browser ,it came up with error HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception ... (0 Replies)
Discussion started by: srinivas2828
0 Replies

10. UNIX for Advanced & Expert Users

any reason for a user without a homedir - security/config/application?

Hi, Can I just quick pick everyone brain here about the following: There is a security audit going on at the company I work for and one of the things that needed to be resolved was that there were a lot of users who don't have a home directory. As this is a fairly large environment of over... (5 Replies)
Discussion started by: Solarius
5 Replies
Login or Register to Ask a Question
DB2_LAST_INSERT_ID(3)							 1						     DB2_LAST_INSERT_ID(3)

db2_last_insert_id - Returns the auto generated ID of the last insert query that successfully executed on this connection

SYNOPSIS
string db2_last_insert_id (resource $resource) DESCRIPTION
Returns the auto generated ID of the last insert query that successfully executed on this connection. The result of this function is not affected by any of the following: o A single row INSERT statement with a VALUES clause for a table without an identity column. o A multiple row INSERT statement with a VALUES clause. o An INSERT statement with a fullselect. o A ROLLBACK TO SAVEPOINT statement. PARAMETERS
o $resource - A valid connection resource as returned from db2_connect(3) or db2_pconnect(3). The value of this parameter cannot be a state- ment resource or result set resource. RETURN VALUES
Returns the auto generated ID of last insert query that successfully executed on this connection. EXAMPLES
Example #1 A db2_last_insert_id(3) example The following example shows how to return the auto generated ID of last insert query that successfully executed on this connection. <?php $database = "SAMPLE"; $user = "db2inst1"; $password = "ibmdb2"; $conn = db2_connect($database, $user, $password); if($conn) { $createTable = "CREATE TABLE lastInsertID (id integer GENERATED BY DEFAULT AS IDENTITY, name varchar(20))"; $insertTable = "INSERT INTO lastInsertID (name) VALUES ('Temp Name')"; $stmt = @db2_exec($conn, $createTable); /* Checking for single row inserted. */ $stmt = db2_exec($conn, $insertTable); $ret = db2_last_insert_id($conn); if($ret) { echo "Last Insert ID is : " . $ret . " "; } else { echo "No Last insert ID. "; } db2_close($conn); } else { echo "Connection failed."; } ?> The above example will output: Last Insert ID is : 1 PHP Documentation Group DB2_LAST_INSERT_ID(3)