LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-16-2009, 03:41 AM   #1
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Rep: Reputation: 0
Scheduler/VB6 program running in Linux Fedora


Hi all,

I have made a vb6 porgram, it is running without any error in windows platform. However, i want it to be run at Fedora too. I run my program with Wine Windows Program Loader in a Linux pc, but the program stuck with an error message:

Run-time error '429':
ActiveX component can't create object

I thought it was the error message because of missing some dll/reference files, so I tried to copy all those related .dll & .ocx file into my wine file. (Just copy and paste into the system32 of wine, no regsvr32 statement to register the .dll as what we always do in Windows.) However, all my efforts are in vain. I not sure what is the cause of this error. Anybody can give me a hint on this issue?

p/s: My purpose to run the vb6 program in linux is because I want to make a scheduler in linux pc so that this program can be run once per day automatically and send email. Any suggestion on how to achieve this also are welcome. I am lost... Many many thanks!
 
Old 11-16-2009, 03:49 AM   #2
lewc
Member
 
Registered: Nov 2009
Distribution: Gentoo, Slackware or Debian
Posts: 60
Blog Entries: 1

Rep: Reputation: 18
content removed

Last edited by lewc; 11-27-2009 at 03:55 PM.
 
Old 11-16-2009, 08:31 PM   #3
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
VB6 program is just my piece of idea since I am totally new to Linux.
Before that I used to use vb6 program as my scheduled task in Windows.

What I want to achieve is, one scheduled program that can be run automatically everyday, check to the database for any due date, if yes, send an email to the person-in-charge; if not, just exit the program and then wait for the next run on tomorrow.
 
Old 11-16-2009, 08:49 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
What does the program do? If all you need is a scheduler you should look into cron.

About the database, what format are you using? If you just need to lookup a few registers in the database you should write a simple bash script to do so, and add it in your crontab or in /etc/cron.daily/. Using native tools will usually be easier. If you want the thing to be portable, you should be looking at portable solutions: like a web app using php or a program made using a portable toolkit, like qt4.

As for wine, I don't think it supports activex at all, I haven't heard of anyone using activex components under wine at least.
 
Old 11-16-2009, 11:30 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,443

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
Definitely sounds like a job for cron (as the scheduler) http://www.adminschoice.com/docs/cro...Crontab%20file and an appropriate prog lang eg bash or Perl.
http://rute.2038bug.com/index.html.gz
http://perldoc.perl.org/
 
Old 11-16-2009, 11:44 PM   #6
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
What i want is I can schedule a task so that it will execute my program everyday (for example in 12 midnight) automatically. While for the program, it is able to check my target database (in MySQL), which with one field named "due_date" in one of the database tables. if the due_date is reached, then the program need to send an email as a notification to the person-in-charge. If none of the due_date is reached, just exit the program and wait for the next run on tomorrow.

I already gave up the idea of runnig VB6 in Linux, now will concentrate on cron. Any idea on how cron can make it?
 
Old 11-17-2009, 09:01 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
Well, cron is the easy part.

You first need to concentrate on the small pieces before. If the database is in mysql then that shouldn't be a problem. This is what you need:
  • find the way to do a query to your db from the command line, you need mysql installed for this of course
  • once you have that value, the rest is simple bash

If you know sql, then you can write your query into a plain text file, then use it like this:

Code:
mysql -u [username] -p somedb < somedb.sql
Being somedb.sql the file containing the sql commands. In bash there's a expansion that allows you to use the output of a given command on a given sentence. Like this:

Code:
VAR=$(mysql ......)
How to parse it or even if this method is adequate depends on the query you are doing. Once you have a working query, you can paste the query and a sample of the output produced by it, and I can help with the bash part. I think that bash is adequate for this task, but any language will work. If you need to do some advanced parsing you might want to try perl instead, or python.

Once you have a working script the cron part is easy, you just need to copy it into /etc/cron.daily/ if you want it to run once every day.
 
Old 11-17-2009, 08:07 PM   #8
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
I created a simple "Hello Perl" script and just for testing purpose to see whether the cron works.

When i type ps aux | grep crond, I get this:
root 2145 0.0 0.1 5260 788 ? Ss Nov16 0:00 crond
admin 11098 0.0 0.1 4216 712 pts/0 S+ 09:58 0:00 grep crond
root 27812 0.0 0.2 5260 1220 ? Ss Nov17 0:00 crond

Then, I type : 01 * * * * perl /etc/perl/testing.pl
it returns: bash: 01: command not found

What is my problem?
If I run the script with perl etc/perl/testing.pl, it works with HELLO PERL printing.
 
Old 11-17-2009, 08:22 PM   #9
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
Quote:
Originally Posted by pu8y View Post
I created a simple "Hello Perl" script and just for testing purpose to see whether the cron works.

When i type ps aux | grep crond, I get this:
root 2145 0.0 0.1 5260 788 ? Ss Nov16 0:00 crond
admin 11098 0.0 0.1 4216 712 pts/0 S+ 09:58 0:00 grep crond
root 27812 0.0 0.2 5260 1220 ? Ss Nov17 0:00 crond

Then, I type : 01 * * * * perl /etc/perl/testing.pl
it returns: bash: 01: command not found

What is my problem?
If I run the script with perl etc/perl/testing.pl, it works with HELLO PERL printing.
Well, there are a couple of them. Where exactly are you writing this line?

Code:
01 * * * * perl /etc/perl/testing.pl
That look like a crontab line, so it goes into /etc/crontab. The crontab file contains a list of scheduled tasks. That line will not run on command line (I think you did just that, because the error you pasted is descriptive enough). Of course, "01" is not a correct command on most linux systems, probably.

Another detail, even if you put that line into crontab, it is not probably what you intended, unless you truly want to run the script using the "perl" user.

Each crontab line has *exactly* six fields AND the remaining is the command to run (whatever number of fields you add after that is irrelevant).

The five first fields are date-related, the 6th is the user whose UID will be used to run the command under. The rest of the line is the command to run. In you case, the date fields are:

Code:
01 * * * *
The user is:

Code:
perl
The command line is

Code:
/etc/perl/testing.pl
You probably wanted this instead:

Code:
01 * * * * root perl /etc/perl/testing.pl
Hence the user would be

Code:
root
And the command line would be

Code:
perl /etc/perl/testing.pl
There might be additional problems with this. The first one is that this is run probably on a minimal environment, $PATH might not be set there so you should really use full paths always:

Code:
01 * * * * root /usr/bin/perl /etc/perl/testing.pl
The second problem is that cron tasks do not run attached to any particular vt, which means that a typical "hello world" will probably remain unnoticed (except for system logs if you have them set verbosely enough). You should probably modify it so it logs the output to a file, mail or whatever, and not stdout.
 
Old 11-17-2009, 09:14 PM   #10
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
[root@xx ~]# 01 * * * * root /usr/bin/perl /etc/testing.pl
bash: 01: command not found
[root@xx ~]# 01 * * * * root perl /etc/testing.pl
bash: 01: command not found
This is what i get. Is the location I wrote the command correct?
 
Old 11-17-2009, 09:27 PM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
Quote:
Originally Posted by pu8y View Post
This is what i get. Is the location I wrote the command correct?
Please, read the post above carefully. As I said, that line is not a command. It's a stanza that goes into the /etc/crontab file, which is the file from where the cron daemon read the scheduled tasks.

You should really read the crontab man page, which can be viewed with this command:

Code:
man 5 crontab
 
Old 11-18-2009, 02:15 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,443

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
This will show you how to use cron & crontab files http://www.adminschoice.com/docs/cro...Crontab%20file
 
Old 11-18-2009, 03:12 AM   #13
pu8y
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Ok, now I have edit my crontab file to be :

Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
#MAILTO=root
HOME=/

# run-parts
*/5 * * * * root /usr/bin/perl /etc/test.pl
Which the test.pl insert the date time NOW() into the database table. I want it to be run every 5 minutes so that I can see an immediate result.

Unfortunately, my cron job execute with an imperfection. That is, every 5 minutes, it insert the record twice.

checkdate
2009-11-18 16:45:01
2009-11-18 16:45:01
2009-11-18 16:50:05
2009-11-18 16:50:05
2009-11-18 16:55:02
2009-11-18 16:55:02

But if i run my perl script seperately, it works fine with only one record inserted.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running cpp program on fedora 6 manish jain Programming 6 04-07-2008 08:17 AM
Running a program automatically after loging in Fedora core 5 jonnyhashem Fedora 4 02-04-2008 05:30 PM
A C program running under Redhat 9 and crushing under Fedora benbrahimh Programming 7 10-14-2005 11:14 AM
How to Run my Active X Control Developed in VB6 in Linux? yesrajesh General 8 09-27-2004 06:43 AM
Find out what scheduler is running contrasutra Linux - Software 1 11-10-2003 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration