Sponsored Content
Full Discussion: Formatting Help needed
Top Forums UNIX for Dummies Questions & Answers Formatting Help needed Post 302429260 by pinga123 on Monday 14th of June 2010 12:26:00 AM
Old 06-14-2010
Formatting Help needed

How would i write a script which will add a following content to a file.

File Before running script.
Code:
acpi = 1
apic = 1
builder = 'hvm'
device_model = '/usr/lib/xen/bin/qemu-dm'
disk = ['file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/running_pool/IFLMUD5IM0196/System-hdc.img,hda,w',
',hdc:cdrom,r',
]

File After running the script.

Code:
acpi = 1
apic = 1
builder = 'hvm'
device_model = '/usr/lib/xen/bin/qemu-dm'
disk =  ['file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/running_pool/IFLMUD5IM0196/System-hdc.img,hda,w',
'file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/iso_pool/WindowXP/XpBoot.iso,hdc:cdrom,r',
]

Here i have added file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/iso_pool/WindowXP/XpBoot.iso
file.

There fore if i want to rerun the script with another value it should remove the previous entry and enter the new entry.
as below.

File Before running script.

Code:
acpi = 1
 apic = 1
 builder = 'hvm'
 device_model = '/usr/lib/xen/bin/qemu-dm'
 disk =  ['file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/running_pool/IFLMUD5IM0196/System-hdc.img,hda,w',
 'file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/iso_pool/WindowXP/XpBoot.iso,hdc:cdrom,r',
 ]

File After running the script.

Code:
acpi = 1
 apic = 1
 builder = 'hvm'
 device_model = '/usr/lib/xen/bin/qemu-dm'
 disk =  ['file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/running_pool/IFLMUD5IM0196/System-hdc.img,hda,w',
 'file:/var/ovs/mount/825D2FF7ED2645428AD5AED714B5E777/iso_pool/Window2003/2k3.iso,hdc:cdrom,r',
 ]

Being a new to unix scripting this task is a big challenge for me and i could not able to solve it.
therefore seeking your help here.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

formatting

I have file with different columns for ex. contents of file "txt" NAME AGE MARKS HARRY 23 89 TOM 12 67 BOB 23 11 and you see its not formatted.Now, I need the file "txt" to be formatted like COLUMN1 COLUMN2 COLUMN3 NAME AGE ... (3 Replies)
Discussion started by: vijay_0209
3 Replies

2. Shell Programming and Scripting

Output formatting help needed.

Hi guys , I have a file which contains following string.(filename tempdisplay) (location 0.0.0.0:5900) i needed to write a script which will extract the string that comes after 0.0.0.0 i.e the string :5900. I have used following method to extract the string :5900 .Is it a preferred way of... (4 Replies)
Discussion started by: pinga123
4 Replies

3. Shell Programming and Scripting

Little formatting help needed.

I have a following string. "machine=IFLMUD5HP0581&group1=Stop" I have created 2 variables namely machine and action. machine should contain IFLMUD5HP0581 action should contain Stop How do i write a script for the same. (7 Replies)
Discussion started by: pinga123
7 Replies

4. Shell Programming and Scripting

Formatting Help needed(Sed)

I have a file called abc.txt which has following contents. 10.180.8.231=31608 10.180.8.232=29011 10.180.8.233=31606 10.180.8.234=40501 10.180.8.235=32591 10.180.8.236=31605 10.180.8.237=30561 10.180.8.238=14231 How would i find a ip address having maximum number of ram available. Here... (2 Replies)
Discussion started by: pinga123
2 Replies

5. Shell Programming and Scripting

Formatting help needed awk or sed maybe

I am executing the following command: sort file1.txt | uniq -c | sort -n > file2.txt The problem is that in file 2, I get leading spaces, Like so: 1 N/A|A8MW11 8 N/A|ufwo1 9 N/A|a8mw11 10 900003|smoketest297688 10 N/A|a9dg4 10 danny|danni 12... (5 Replies)
Discussion started by: ddurden7
5 Replies

6. Shell Programming and Scripting

Help needed in formatting script files

Hi, Can anyone tell me how i can convert all tab spaces inside a script to 4 spaces through another script. Also i need to find if all the quotes are matching and ended properly. Any idea whould be of great help. Many thanks! (3 Replies)
Discussion started by: justchill
3 Replies

7. Shell Programming and Scripting

Formatting

Is there a way to make a 2 column output out of the following : 1 2 3 4 5 6 Output : 1 2 3 4 5 6 Thanks, Prasanna (3 Replies)
Discussion started by: prasanna1157
3 Replies

8. Shell Programming and Scripting

formatting of df -k

Hello, I am developing a platform Independant tool that should work for all major unix flavors outlined in this forum(Solaris,Linux, AIX, HPUX, SCO,BSD) Therefore, in order to cover all types of user community, I have deliberately posted the same message on every forum. Please do not think... (9 Replies)
Discussion started by: darsh123
9 Replies

9. Shell Programming and Scripting

Help needed in formatting the Output file

Hi All, Need your help in resolving the below issue. I've a file called "data.txt" with the below lines: TT: <tell://me/sreenivas> <tell://me/100> TT: <tell://me/sudheer> <tell://me/300> TT: <tell://me/sreenivas> <tell://me/200> TT: <tell://me/sudheer> <tell://me/400> ... (3 Replies)
Discussion started by: raosr020
3 Replies

10. Shell Programming and Scripting

Help needed in formatting the output

Hi All, Need your help in resolving the below issue. I've a file called "data.txt" with the below lines: TT: <tell://me/sreenivas> <tell://me/100> <tell://me/500> TT: <tell://me/sudheer> <tell://me/300> TT: <tell://me/sreenivas> <tell://me/200> TT:... (6 Replies)
Discussion started by: raosr020
6 Replies
openvswitch_selinux(8)					    SELinux Policy openvswitch					    openvswitch_selinux(8)

NAME
openvswitch_selinux - Security Enhanced Linux Policy for the openvswitch processes DESCRIPTION
Security-Enhanced Linux secures the openvswitch processes via flexible mandatory access control. The openvswitch processes execute with the openvswitch_t SELinux type. You can check if you have these processes running by executing the ps command with the -Z qualifier. For example: ps -eZ | grep openvswitch_t ENTRYPOINTS
The openvswitch_t SELinux type can be entered via the openvswitch_exec_t file type. The default entrypoint paths for the openvswitch_t domain are the following: /usr/bin/ovs-vsctl, /usr/sbin/ovsdb-ctl, /usr/bin/ovs-appctl, /usr/sbin/ovsdb-server, /usr/sbin/ovs-vswitchd, /usr/share/open- vswitch/scripts/ovs-ctl PROCESS TYPES
SELinux defines process types (domains) for each process running on the system You can see the context of a process using the -Z option to ps Policy governs the access confined processes have to files. SELinux openvswitch policy is very flexible allowing users to setup their openvswitch processes in as secure a method as possible. The following process types are defined for openvswitch: openvswitch_t Note: semanage permissive -a openvswitch_t can be used to make the process type openvswitch_t permissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated. BOOLEANS
SELinux policy is customizable based on least access required. openvswitch policy is extremely flexible and has several booleans that allow you to manipulate the policy and run openvswitch with the tightest access possible. If you want to allow all daemons to write corefiles to /, you must turn on the daemons_dump_core boolean. Disabled by default. setsebool -P daemons_dump_core 1 If you want to enable cluster mode for daemons, you must turn on the daemons_enable_cluster_mode boolean. Enabled by default. setsebool -P daemons_enable_cluster_mode 1 If you want to allow all daemons to use tcp wrappers, you must turn on the daemons_use_tcp_wrapper boolean. Disabled by default. setsebool -P daemons_use_tcp_wrapper 1 If you want to allow all daemons the ability to read/write terminals, you must turn on the daemons_use_tty boolean. Disabled by default. setsebool -P daemons_use_tty 1 If you want to deny any process from ptracing or debugging any other processes, you must turn on the deny_ptrace boolean. Enabled by default. setsebool -P deny_ptrace 1 If you want to allow all domains to use other domains file descriptors, you must turn on the domain_fd_use boolean. Enabled by default. setsebool -P domain_fd_use 1 If you want to allow all domains to have the kernel load modules, you must turn on the domain_kernel_load_modules boolean. Disabled by default. setsebool -P domain_kernel_load_modules 1 If you want to allow all domains to execute in fips_mode, you must turn on the fips_mode boolean. Enabled by default. setsebool -P fips_mode 1 If you want to enable reading of urandom for all domains, you must turn on the global_ssp boolean. Disabled by default. setsebool -P global_ssp 1 If you want to allow confined applications to use nscd shared memory, you must turn on the nscd_use_shm boolean. Enabled by default. setsebool -P nscd_use_shm 1 PORT TYPES
SELinux defines port types to represent TCP and UDP ports. You can see the types associated with a port by using the following command: semanage port -l Policy governs the access confined processes have to these ports. SELinux openvswitch policy is very flexible allowing users to setup their openvswitch processes in as secure a method as possible. The following port types are defined for openvswitch: openvswitch_port_t Default Defined Ports: tcp 6634 MANAGED FILES
The SELinux process type openvswitch_t can manage files labeled with the following file types. The paths listed are the default paths for these file types. Note the processes UID still need to have DAC permissions. cluster_conf_t /etc/cluster(/.*)? cluster_var_lib_t /var/lib/pcsd(/.*)? /var/lib/cluster(/.*)? /var/lib/openais(/.*)? /var/lib/pengine(/.*)? /var/lib/corosync(/.*)? /usr/lib/heartbeat(/.*)? /var/lib/heartbeat(/.*)? /var/lib/pacemaker(/.*)? cluster_var_run_t /var/run/crm(/.*)? /var/run/cman_.* /var/run/rsctmp(/.*)? /var/run/aisexec.* /var/run/heartbeat(/.*)? /var/run/cpglockd.pid /var/run/corosync.pid /var/run/rgmanager.pid /var/run/cluster/rgmanager.sk openvswitch_log_t /var/log/openvswitch(/.*)? openvswitch_rw_t /etc/openvswitch(/.*)? openvswitch_tmp_t openvswitch_var_lib_t /var/lib/openvswitch(/.*)? openvswitch_var_run_t /var/run/openvswitch(/.*)? root_t / /initrd FILE CONTEXTS
SELinux requires files to have an extended attribute to define the file type. You can see the context of a file using the -Z option to ls Policy governs the access confined processes have to these files. SELinux openvswitch policy is very flexible allowing users to setup their openvswitch processes in as secure a method as possible. STANDARD FILE CONTEXT SELinux defines the file context types for the openvswitch, if you wanted to store files with these types in a diffent paths, you need to execute the semanage command to sepecify alternate labeling and then use restorecon to put the labels on disk. semanage fcontext -a -t openvswitch_exec_t '/srv/openvswitch/content(/.*)?' restorecon -R -v /srv/myopenvswitch_content Note: SELinux often uses regular expressions to specify labels that match multiple files. The following file types are defined for openvswitch: openvswitch_exec_t - Set files with the openvswitch_exec_t type, if you want to transition an executable to the openvswitch_t domain. Paths: /usr/bin/ovs-vsctl, /usr/sbin/ovsdb-ctl, /usr/bin/ovs-appctl, /usr/sbin/ovsdb-server, /usr/sbin/ovs-vswitchd, /usr/share/open- vswitch/scripts/ovs-ctl openvswitch_log_t - Set files with the openvswitch_log_t type, if you want to treat the data as openvswitch log data, usually stored under the /var/log directory. openvswitch_rw_t - Set files with the openvswitch_rw_t type, if you want to treat the files as openvswitch read/write content. openvswitch_tmp_t - Set files with the openvswitch_tmp_t type, if you want to store openvswitch temporary files in the /tmp directories. openvswitch_unit_file_t - Set files with the openvswitch_unit_file_t type, if you want to treat the files as openvswitch unit content. openvswitch_var_lib_t - Set files with the openvswitch_var_lib_t type, if you want to store the openvswitch files under the /var/lib directory. openvswitch_var_run_t - Set files with the openvswitch_var_run_t type, if you want to store the openvswitch files under the /run or /var/run directory. Note: File context can be temporarily modified with the chcon command. If you want to permanently change the file context you need to use the semanage fcontext command. This will modify the SELinux labeling database. You will need to use restorecon to apply the labels. COMMANDS
semanage fcontext can also be used to manipulate default file context mappings. semanage permissive can also be used to manipulate whether or not a process type is permissive. semanage module can also be used to enable/disable/install/remove policy modules. semanage port can also be used to manipulate the port definitions semanage boolean can also be used to manipulate the booleans system-config-selinux is a GUI tool available to customize SELinux policy settings. AUTHOR
This manual page was auto-generated using sepolicy manpage . SEE ALSO
selinux(8), openvswitch(8), semanage(8), restorecon(8), chcon(1), sepolicy(8) , setsebool(8) openvswitch 14-06-10 openvswitch_selinux(8)
All times are GMT -4. The time now is 05:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy