Sponsored Content
Full Discussion: Shell script error
Top Forums Shell Programming and Scripting Shell script error Post 302363934 by tezarin on Wednesday 21st of October 2009 03:49:22 PM
Old 10-21-2009
Shell script error

Hi,

I have the following table in MYSQL: (the structure looks broken in this forum but if you copy/paste it into notepad, it'll look right):

+----------------------------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------+-----------------------+------+-----+---------+----------------+
| id | mediumint(8) unsigned | NO | PRI | NULL | auto_increment |
| hash | varchar(32) | NO | | | |
| local_data_template_rrd_id | mediumint(8) unsigned | NO | MUL | 0 | |
| local_data_id | mediumint(8) unsigned | NO | MUL | 0 | |
| data_template_id | mediumint(8) unsigned | NO | MUL | 0 | |
| t_rrd_maximum | char(2) | YES | | NULL | |
| rrd_maximum | varchar(20) | NO | | 0 | |
| t_rrd_minimum | char(2) | YES | | NULL | |
| rrd_minimum | varchar(20) | NO | | 0 | |
| t_rrd_heartbeat | char(2) | YES | | NULL | |
| rrd_heartbeat | mediumint(6) | NO | | 0 | |
| t_data_source_type_id | char(2) | YES | | NULL | |
| data_source_type_id | smallint(5) | NO | | 0 | |
| t_data_source_name | char(2) | YES | | NULL | |
| data_source_name | varchar(19) | NO | | | |
| t_data_input_field_id | char(2) | YES | | NULL | |
| data_input_field_id | mediumint(8) unsigned | NO | | 0 | |
+----------------------------+-----------------------+------+-----+---------+----------------+


And am trying to run the following command:

INSERT INTO data_template_rrd (id, hash, local_data_template_rrd_id, local_data_id, data_template_id, t_rrd_maximum, rrd_maximum, t_rrd_minimum, rrd_minimum, t_rrd_heartbeat, rrd_heartbeat, t_data_source_type_id, data_source_type_id, t_data_source_name, data_source_name, t_data_input_field_id, data_input_field_id) VALUES (138, '', 102, 37, 49, on , 0, on, 0, on, 600, on, 2, on, 'Internal', NULL, 0);

(the ID=138 is being auto generated by a line of code:
NEXTAID=`$mysqlcmd -L -N --batch -u$mysqluser -p$mysqlpassword $database -e "SELECT MAX(id) as max_id from data_template_rrd;"` )


But I am getting an error message:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on , 0, on, 0, on, 600, on, 2, on, 'Internal', NULL, 0)' at line 1


Can someone please help me fix it?

Thanks

Last edited by tezarin; 10-22-2009 at 02:36 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

error in shell script

Hi, I have written a small shell script which logs into each oracle database on the server and displays whether it is in archivelog mode or not.. The script is as under: #!/bin/bash dblist=`ps -ef | grep smon | grep -v grep |cut -d'_' -f3` for ohome in $dblist; do sqlplus -s /nolog <<... (2 Replies)
Discussion started by: jalpan.pota
2 Replies

2. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

3. UNIX for Dummies Questions & Answers

Shell Script Error

Sorry typo found please ignore (0 Replies)
Discussion started by: jazz8146
0 Replies

4. Shell Programming and Scripting

How to grep sql error in shell script and exit the script?

I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts. Here is my script #!/bin/csh -f source .orapass set user = $USER set pass = $PASS cd /opt/data/scripts echo... (2 Replies)
Discussion started by: allinshell99
2 Replies

5. Shell Programming and Scripting

Error in Shell script

Hello All, I am newbe to scripting and have just taken over following script from previous developer. I am getting following error when running the script. line 70: syntax error near unexpected token `do Could some help me to rectify the error please. Thanks in advance for your... (9 Replies)
Discussion started by: Pahadia
9 Replies

6. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

7. Shell Programming and Scripting

Error in calling a shell script from another script

HI, We are using two shell scripts, script.sh,env.sh, where env.sh will be called inside script.sh. The variable inside env.sh is used as $var in script.sh.But while running the script its not identifying that variable. Is there any permission needed to call a script inside another script. ... (3 Replies)
Discussion started by: banupriyat
3 Replies

8. Shell Programming and Scripting

Calling shell script within awk script throws error

I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks sh: -c: line 0: syntax error near unexpected token `newline' sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies

9. Shell Programming and Scripting

Shell script with sql script error

Hi All when I execute from psql prompt, I get the result, when I try to automate using a shell script, the query is not working # `/usr/bin/psql -U postgres -d coba1 -c "select name from users where "Date" > current_date - 30;"` ERROR: column "Date" does not exist LINE 1: select... (2 Replies)
Discussion started by: srilinux09
2 Replies
Mail::SpamAssassin::SQLBasedAddrList(3) 		User Contributed Perl Documentation		   Mail::SpamAssassin::SQLBasedAddrList(3)

NAME
Mail::SpamAssassin::SQLBasedAddrList - SpamAssassin SQL Based Auto Whitelist SYNOPSIS
my $factory = Mail::SpamAssassin::SQLBasedAddrList->new() $spamtest->set_persistent_addr_list_factory ($factory); ... call into SpamAssassin classes... SpamAssassin will call: my $addrlist = $factory->new_checker($spamtest); $entry = $addrlist->get_addr_entry ($addr, $origip); ... DESCRIPTION
A SQL based persistent address list implementation. See "Mail::SpamAssassin::PersistentAddrList" for more information. Uses DBI::DBD module access to your favorite database (tested with MySQL, SQLite and PostgreSQL) to store user auto-whitelists. The default table structure looks like this: CREATE TABLE awl ( username varchar(100) NOT NULL default '', email varchar(255) NOT NULL default '', ip varchar(16) NOT NULL default '', count int(11) NOT NULL default '0', totscore float NOT NULL default '0', signedby varchar(255) NOT NULL default '', PRIMARY KEY (username,email,signedby,ip) ) TYPE=MyISAM; Your table definition may change depending on which database driver you choose. There is a config option to override the table name. This module introduces several new config variables: user_awl_dsn user_awl_sql_username user_awl_sql_password user_awl_sql_table user_awl_sql_override_username see "Mail::SpamAssassin::Conf" for more information. new public class (Mail::SpamAssassin::SQLBasedAddrList) new () Description: This method creates a new instance of the SQLBasedAddrList factory and calls the parent's (PersistentAddrList) new method. new_checker public instance (Mail::SpamAssassin::SQLBasedAddrList) new_checker (\% $main) Description: This method is called to setup a new checker interface and return a blessed copy of itself. Here is where we setup the SQL database connection based on the config values. get_addr_entry public instance (\%) get_addr_entry (String $addr, String $signedby) Description: This method takes a given $addr and splits it between the email address component and the ip component and performs a lookup in the database. If nothing is found in the database then a blank entry hash is created and returned, otherwise an entry containing the found information is returned. If a with_awl_signer configuration option is enabled only addresses signed by the given signing identity are taken into account, or, if $signedby is undefined (or empty) only unsigned entries are considered. A key, "exists_p", is set to 1 if an entry already exists in the database, otherwise it is set to 0. add_score public instance (\%) add_score (\% $entry, Integer $score) Description: This method adds a given $score to a given $entry. If the entry was marked as not existing in the database then an entry will be inserted, otherwise a simple update will be performed. NOTE: This code uses a self referential SQL call (ie set foo = foo + 1) which is supported by most modern database backends, but not everything calling itself a SQL database. remove_entry public instance () remove_entry (\% $entry) Description: This method removes a given $entry from the database. If the ip portion of the entry address is equal to "none" then remove any perl-IP entries for this address as well. finish public instance () finish () Description: This method provides the necessary cleanup for the address list. _unpack_addr private instance (String, String) _unpack_addr(string $addr) Description: This method splits an autowhitelist address into it's two components, email and ip address. perl v5.12.1 2010-03-16 Mail::SpamAssassin::SQLBasedAddrList(3)
All times are GMT -4. The time now is 01:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy